/**
 * Полировка CRM под UI-kit платформы «Есть Дело».
 * Не переписывает разметку — только токены и ключевые поверхности.
 */

body {
  font-family: var(--ed-font-sans);
  font-size: var(--ed-text-body);
  line-height: var(--ed-leading-body);
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}

h1, .page-header h1 {
  font-family: var(--ed-font-display);
  font-size: var(--ed-text-h1);
  font-weight: 700;
  line-height: var(--ed-leading-tight);
  letter-spacing: -0.02em;
  color: var(--ed-neutral-900);
}

h2 {
  font-size: var(--ed-text-h2);
  font-weight: 700;
  line-height: var(--ed-leading-tight);
}

h3 {
  font-size: var(--ed-text-h3);
  font-weight: 600;
}

/* Header / chrome */
header, footer {
  background: var(--ed-neutral-50);
  border-bottom: var(--ed-border-s) solid var(--ed-neutral-200);
}

footer {
  border-bottom: none;
  border-top: var(--ed-border-s) solid var(--ed-neutral-200);
  background: var(--ed-neutral-50);
}

.logo {
  color: var(--ed-violet-700);
  font-weight: 700;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
}

.logo-mark {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: block;
  border-radius: 9px;
}

.logo-mark--dark {
  display: none;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.logo-brand {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ed-neutral-900);
}

.logo-product {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ed-violet-600);
}

html[data-theme="dark"] .logo-brand {
  color: var(--ed-neutral-50);
}

html[data-theme="dark"] .logo-product {
  color: var(--ed-violet-300);
}

html[data-theme="dark"] .logo-mark--light {
  display: none;
}

html[data-theme="dark"] .logo-mark--dark {
  display: block;
}

.nav-menu a {
  color: var(--ed-neutral-800);
  border-radius: var(--ed-radius-s);
  font-weight: 600;
}

.nav-menu a:hover {
  background: var(--ed-violet-50);
  color: var(--ed-violet-700);
  text-decoration: none;
}

.nav-menu a.nav-pin {
  background: var(--ed-violet-50);
  border: var(--ed-border-s) solid var(--ed-violet-200);
  color: var(--ed-violet-800);
}

main {
  max-width: 1200px;
}

/* С сайдбаром — контент на всю ширину колонки (не «телефонная» полоска 1200px) */
body.has-sidebar main {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 1rem 1.5rem 2rem;
  box-sizing: border-box;
}

@media (max-width: 900px) {
  body.has-sidebar main {
    padding: 0.85rem 1rem 5rem;
  }
}

/* Surfaces / cards */
.card-grid li a,
.data-table,
.highlights-panel,
.applicant-overview,
.consent-alert,
.legal-hold-set,
.legal-hold-banner,
.stat-card,
.empty-state,
.crm-dialog,
.utility-note-dialog,
.filter-panel,
.next-steps,
.report-files,
.report-review {
  border-radius: var(--radius-card);
}

.card-grid li a {
  background: var(--color-surface);
  border: var(--ed-border-l) solid var(--ed-neutral-300);
  color: var(--ed-violet-700);
  box-shadow: 0 1px 2px rgba(36, 34, 40, 0.04);
}

.card-grid li a:hover {
  background: var(--ed-violet-50);
  border-color: var(--ed-violet-300);
}

/* Buttons */
button,
.btn-primary-link,
.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--ed-radius-s);
  font-family: var(--ed-font-sans);
  font-weight: 600;
  font-size: var(--ed-text-body);
  padding: 0.6rem 1.15rem;
}

button:hover,
.btn-primary-link:hover,
.btn-primary:hover {
  background: var(--color-primary-hover);
}

.btn-secondary,
a.btn-secondary {
  background: var(--ed-neutral-50);
  color: var(--ed-violet-700);
  border: var(--ed-border-l) solid var(--ed-violet-200);
  border-radius: var(--ed-radius-s);
  font-weight: 600;
  text-decoration: none;
  padding: 0.55rem 1rem;
  display: inline-block;
}

.btn-secondary:hover,
a.btn-secondary:hover {
  background: var(--ed-violet-50);
  border-color: var(--ed-violet-400);
  color: var(--ed-violet-800);
}

.btn-danger,
.btn-danger-link {
  background: var(--ed-red-600);
  border-radius: var(--ed-radius-s);
}

.btn-danger:hover,
.btn-danger-link:hover {
  background: var(--ed-red-700);
}

.mode-toggle,
.logout-btn {
  background: var(--ed-neutral-200);
  color: var(--ed-neutral-800);
  border-radius: var(--ed-radius-s);
}

.mode-toggle:hover,
.logout-btn:hover {
  background: var(--ed-neutral-300);
}

/* Forms */
.field label {
  color: var(--ed-neutral-800);
  font-weight: 600;
  font-size: var(--ed-text-small);
}

.field input,
.field select,
.field textarea,
.interaction-form input,
.interaction-form select,
.interaction-form textarea,
.model-form input,
.model-form select,
.model-form textarea,
.filter-panel input,
.filter-panel select,
.login-form input,
.crm-dialog-form input,
.crm-dialog-form select,
.crm-dialog-form textarea {
  border: var(--ed-border-l) solid var(--ed-neutral-400);
  border-radius: var(--ed-radius-s);
  background: var(--ed-neutral-50);
  color: var(--ed-neutral-900);
  font-family: var(--ed-font-sans);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--ed-violet-500);
}

.form-errors,
.consent-alert {
  background: var(--color-danger-bg);
  border-color: var(--ed-red-300);
  color: var(--ed-red-800);
  border-radius: var(--ed-radius-m);
}

.consent-alert--soft {
  background: var(--color-warning-bg);
  border-color: var(--ed-peach-300);
  color: var(--ed-peach-800);
}

/* Tables */
.data-table {
  background: var(--color-surface);
  border: var(--ed-border-s) solid var(--ed-neutral-200);
  overflow: hidden;
}

.data-table th {
  background: var(--ed-neutral-100);
  color: var(--ed-neutral-700);
  font-size: var(--ed-text-small);
  font-weight: 600;
  border-bottom: var(--ed-border-s) solid var(--ed-neutral-200);
}

.data-table td,
.data-table th {
  border-color: var(--ed-neutral-200);
}

.data-table tr:hover td {
  background: var(--ed-violet-50);
}

/* Highlights / chips / badges */
.highlights-panel {
  background: var(--ed-violet-50);
  border: var(--ed-border-s) solid var(--ed-violet-100);
  padding: var(--ed-space-l);
}

.highlights-panel--sla {
  background: var(--ed-peach-50);
  border-color: var(--ed-peach-200);
}

.filter-chip {
  border-radius: 999px;
  border: var(--ed-border-s) solid var(--ed-neutral-300);
  background: var(--ed-neutral-50);
  color: var(--ed-violet-700);
}

.filter-chip--active {
  background: var(--ed-violet-600);
  border-color: var(--ed-violet-600);
  color: #fff;
}

.stage-badge,
.status-badge,
.sp-badge,
.sla-badge {
  border-radius: 999px;
}

/* Utility bar */
.utility-bar {
  background: var(--ed-neutral-900);
  border-top: none;
}

.utility-bar button {
  background: var(--ed-neutral-800);
  color: var(--ed-neutral-50);
  border-radius: var(--ed-radius-s);
}

.utility-bar button:hover {
  background: var(--ed-violet-700);
}

/* Focus — kit blue, keeps WCAG visible ring */
*:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

.skip-link {
  background: var(--ed-violet-700);
}

/* Dark theme → kit neutrals / violet */
html[data-theme="dark"] {
  --color-bg: var(--ed-neutral-900);
  --color-surface: var(--ed-neutral-800);
  --color-text: var(--ed-neutral-100);
  --color-muted: var(--ed-neutral-400);
  --color-border: var(--ed-neutral-700);
  --color-primary: var(--ed-violet-400);
  --color-primary-hover: var(--ed-violet-300);
  --color-primary-soft: var(--ed-violet-900);
  --color-focus: var(--ed-blue-400);
}

html[data-theme="dark"] body {
  background: var(--ed-neutral-900);
  color: var(--ed-neutral-100);
}

html[data-theme="dark"] header,
html[data-theme="dark"] footer {
  background: var(--ed-neutral-800);
  border-color: var(--ed-neutral-700);
}

html[data-theme="dark"] .data-table,
html[data-theme="dark"] .card-grid li a,
html[data-theme="dark"] .highlights-panel {
  background: var(--ed-neutral-800);
  border-color: var(--ed-neutral-700);
  color: var(--ed-neutral-100);
}

html[data-theme="dark"] .data-table th {
  background: var(--ed-neutral-900);
  color: var(--ed-neutral-300);
}

html[data-theme="dark"] .nav-menu a {
  color: var(--ed-neutral-100);
}

html[data-theme="dark"] .btn-secondary,
html[data-theme="dark"] a.btn-secondary {
  background: var(--ed-neutral-800);
  color: var(--ed-violet-200);
  border-color: var(--ed-violet-700);
}

/* ——— P0 UX: nav / filters / case tabs / utility FAB ——— */

.nav-section-label {
  list-style: none;
  margin: 0.55rem 0.4rem 0.15rem;
  padding: 0.2rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ed-neutral-500);
}

.stat-cards--focus {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  align-items: stretch;
}

.stat-cards--focus .stat-card {
  flex: none;
  width: 100%;
  min-width: 0;
}

body.has-sidebar .dashboard-blocks {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr));
  gap: 1.25rem 1.5rem;
}

@media (min-width: 1280px) {
  body.has-sidebar .dashboard-blocks {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1600px) {
  body.has-sidebar .dashboard-blocks {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .stat-cards--focus {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }

  body.has-sidebar .dashboard-blocks {
    grid-template-columns: 1fr;
  }
}

.filter-panel--compact .filter-row--primary {
  align-items: end;
}

.filter-more {
  margin-top: 0.65rem;
}

.filter-more > summary {
  cursor: pointer;
  color: var(--ed-violet-700);
  font-weight: 600;
  font-size: 0.92rem;
  list-style: none;
}

.filter-more > summary::-webkit-details-marker {
  display: none;
}

.filter-more[open] > summary {
  margin-bottom: 0.5rem;
}

.filter-row--more {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
}

.case-summary.highlights-panel {
  position: sticky;
  top: 0;
  z-index: 18;
  margin-bottom: 1rem;
}

.case-summary .sticky-contact-bar {
  position: static;
  margin: 0.75rem 0 0;
  background: transparent;
  border: 0;
  padding: 0;
}

.case-workspace {
  margin-top: 0.5rem;
}

.case-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0 0 1rem;
  padding: 0.25rem;
  border-bottom: 1px solid var(--ed-neutral-200);
}

.case-tabs [role="tab"] {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ed-neutral-700);
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--ed-radius-sm, 8px);
  cursor: pointer;
}

.case-tabs [role="tab"]:hover {
  background: var(--ed-violet-50);
  color: var(--ed-violet-800);
}

.case-tabs [role="tab"][aria-selected="true"] {
  background: var(--ed-violet-100);
  color: var(--ed-violet-800);
  box-shadow: inset 0 -2px 0 var(--ed-violet-600);
}

.case-tabs [role="tab"]:focus-visible {
  outline: 3px solid var(--ed-blue-500, #3b82f6);
  outline-offset: 2px;
}

.utility-tools {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 40;
}

.utility-tools > summary.utility-fab {
  list-style: none;
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ed-violet-600);
  color: #fff;
  font-size: 1.15rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(36, 7, 80, 0.28);
  border: 0;
}

.utility-tools > summary.utility-fab::-webkit-details-marker {
  display: none;
}

.utility-tools[open] > summary.utility-fab,
.utility-tools--running > summary.utility-fab {
  background: var(--ed-violet-800);
}

.utility-tools .utility-bar {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.5rem);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 12rem;
  padding: 0.65rem;
  border-radius: 12px;
  background: var(--ed-neutral-900);
  color: var(--ed-neutral-50);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.28);
}

.utility-tools .utility-bar button {
  width: 100%;
  justify-content: center;
}

html[data-theme="dark"] .case-tabs {
  border-bottom-color: var(--ed-neutral-700);
}

html[data-theme="dark"] .case-tabs [role="tab"] {
  color: var(--ed-neutral-200);
}

html[data-theme="dark"] .case-tabs [role="tab"][aria-selected="true"] {
  background: var(--ed-violet-900);
  color: var(--ed-violet-100);
}

/* ——— P1 UX: command palette, role focus, header-more, compact cols ——— */

.global-search {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.cmdk-trigger {
  appearance: none;
  border: 1px solid var(--ed-neutral-300);
  background: var(--ed-neutral-50);
  color: var(--ed-neutral-600);
  border-radius: 8px;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
  white-space: nowrap;
}

.cmdk-trigger:hover {
  border-color: var(--ed-violet-400);
  color: var(--ed-violet-800);
}

.command-palette {
  border: 0;
  border-radius: 16px;
  padding: 0;
  width: min(36rem, calc(100vw - 2rem));
  max-height: min(70vh, 32rem);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
}

.command-palette::backdrop {
  background: rgba(15, 23, 42, 0.4);
}

.cmdk-input {
  width: 100%;
  box-sizing: border-box;
  border: 0;
  border-bottom: 1px solid var(--ed-neutral-200);
  padding: 1rem 1.1rem;
  font: inherit;
  font-size: 1.05rem;
}

.cmdk-input:focus {
  outline: none;
}

.cmdk-results {
  max-height: 22rem;
  overflow: auto;
  padding: 0.5rem 0;
}

.cmdk-group-title {
  margin: 0.4rem 1rem 0.2rem;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ed-neutral-500);
}

.cmdk-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cmdk-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.55rem 1.1rem;
  text-decoration: none;
  color: var(--ed-neutral-900);
}

.cmdk-item:hover,
.cmdk-item--active,
.cmdk-item[aria-current="true"] {
  background: var(--ed-violet-50);
}

.cmdk-item-title {
  font-weight: 600;
}

.cmdk-item-sub {
  font-size: 0.82rem;
  color: var(--ed-neutral-500);
}

.cmdk-empty,
.cmdk-hint {
  margin: 0.75rem 1.1rem;
  color: var(--ed-neutral-500);
  font-size: 0.85rem;
}

.role-focus {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: var(--ed-violet-50);
  border: 1px solid var(--ed-violet-100);
}

.role-focus-label {
  display: block;
  color: var(--ed-violet-800);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.role-focus-blurb {
  margin: 0.15rem 0 0;
  color: var(--ed-neutral-700);
  font-size: 0.92rem;
}

.role-focus-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.role-focus-links a {
  text-decoration: none;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--ed-violet-200);
  color: var(--ed-violet-800);
}

.header-more {
  position: relative;
}

.header-more > summary {
  list-style: none;
  cursor: pointer;
}

.header-more > summary::-webkit-details-marker {
  display: none;
}

.header-more-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  z-index: 30;
  min-width: 12rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.45rem;
  background: #fff;
  border: 1px solid var(--ed-neutral-200);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}

.header-more-menu a,
.header-more-menu .fav-btn,
.header-more-menu button {
  display: block;
  text-align: left;
  text-decoration: none;
  color: var(--ed-neutral-800);
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.header-more-menu a:hover,
.header-more-menu .fav-btn:hover,
.header-more-menu button:hover {
  background: var(--ed-violet-50);
}

.header-more-menu .danger-link {
  color: var(--ed-red-700, #b91c1c);
}

.data-table--compact-cols .col-extra {
  display: none;
}

.data-table--compact-cols.data-table--show-extra .col-extra {
  display: table-cell;
}

button.linkish {
  appearance: none;
  border: 0;
  background: none;
  color: var(--ed-violet-700);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.empty-state--single {
  text-align: left;
}

.timeline--unified {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--ed-neutral-200);
}

html[data-theme="dark"] .role-focus {
  background: var(--ed-violet-950, #1a0b2e);
  border-color: var(--ed-violet-800);
}

html[data-theme="dark"] .header-more-menu {
  background: var(--ed-neutral-900);
  border-color: var(--ed-neutral-700);
}

html[data-theme="dark"] .command-palette {
  background: var(--ed-neutral-900);
  color: var(--ed-neutral-50);
}

html[data-theme="dark"] .cmdk-item {
  color: var(--ed-neutral-50);
}

html[data-theme="dark"] .cmdk-item:hover,
html[data-theme="dark"] .cmdk-item--active {
  background: var(--ed-violet-900);
}

/* ——— P2 UX: token alignment, status markers, mobile bottom nav, toast ——— */

.unread-dot,
.leaderboard-rank,
.msg--mine .msg-bubble {
  background: var(--ed-violet-600) !important;
}

.crm-cal-day-card--today,
.crm-cal-day--today {
  border-color: var(--ed-violet-600) !important;
  box-shadow: 0 0 0 2px rgba(126, 79, 220, 0.18);
}

.timeline-item--interaction::before,
.timeline-item--placement::before,
.timeline-item--reminder::before,
.timeline-item--document::before {
  background: var(--ed-violet-500, #9065e5);
}

/* Status: color + text marker (not color-only) */
.consent-badge--ok::before { content: "✓ "; font-weight: 700; }
.consent-badge--expiring::before { content: "… "; font-weight: 700; }
.consent-badge--expired::before { content: "× "; font-weight: 700; }
.consent-badge--missing::before { content: "! "; font-weight: 700; }
.consent-badge--no_date::before { content: "? "; font-weight: 700; }

.overdue-badge {
  border: 1px solid currentColor;
}
.overdue-badge::before {
  content: "⚠ ";
}

.stage-badge {
  border-width: 1px;
  border-style: solid;
}
.stage-badge--new { border-color: var(--ed-violet-300, #b996ef); }
.stage-badge--contact { border-color: var(--ed-blue-400, #7d9cff); }
.stage-badge--hired { border-color: var(--ed-green-500, #9fd93a); }
.stage-badge--closed,
.stage-badge--paused { border-color: var(--ed-red-400, #f07167); }

.status-badge {
  border: 1px solid currentColor;
}

/* Icon + visible text for chrome controls */
.nav-icon-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 44px;
  min-width: 44px;
  padding: 0.35rem 0.45rem;
  text-decoration: none;
  color: inherit;
  position: relative;
}

.nav-glyph-label {
  font-size: 0.78rem;
  font-weight: 600;
}

@media (min-width: 769px) {
  .nav-glyph-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}

/* Touch targets */
@media (max-width: 768px) {
  .btn-primary-link,
  .btn-secondary,
  button,
  .logout-btn,
  .mode-toggle,
  .quick-create-btn,
  .cmdk-trigger,
  .crm-cal-scroll-btn {
    min-height: 44px;
    min-width: 44px;
  }

  .nav-user .user-name,
  .nav-user .mode-toggle {
    display: none;
  }
}

/* Mobile bottom nav */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 35;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    background: #fff;
    border-top: 1px solid var(--ed-neutral-200);
    padding: 0.25rem 0 calc(0.25rem + env(safe-area-inset-bottom, 0));
    box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.08);
  }

  .mobile-bottom-nav__item {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    text-decoration: none;
    color: var(--ed-neutral-600);
    font-weight: 600;
    font-size: 0.82rem;
  }

  .mobile-bottom-nav__item.is-active {
    color: var(--ed-violet-700);
  }

  .mobile-bottom-nav__item.is-active .mobile-bottom-nav__label {
    box-shadow: inset 0 -2px 0 var(--ed-violet-600);
  }

  body {
    padding-bottom: 4.5rem;
  }

  .utility-tools {
    bottom: 4.25rem;
  }
}

html[data-theme="dark"] .mobile-bottom-nav {
  background: var(--ed-neutral-900);
  border-top-color: var(--ed-neutral-700);
}

/* Optimistic / saving feedback */
form.is-saving {
  opacity: 0.65;
  pointer-events: none;
  position: relative;
}

form.is-saving::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(126, 79, 220, 0.08), transparent);
  animation: ed-skeleton 1.1s linear infinite;
}

@keyframes ed-skeleton {
  from { transform: translateX(-40%); }
  to { transform: translateX(40%); }
}

.action-toast {
  position: fixed;
  left: 50%;
  bottom: 5.5rem;
  transform: translateX(-50%) translateY(12px);
  z-index: 60;
  background: var(--ed-neutral-900);
  color: #fff;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.action-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (min-width: 769px) {
  .action-toast {
    bottom: 1.5rem;
  }
}

/* Classic vs gamified interface modes (data-mode on <html>) */
html[data-mode="classic"] .xp-panel,
html[data-mode="classic"] .dashboard-challenge,
html[data-mode="classic"] .dashboard-quests,
html[data-mode="classic"] .mascot {
  display: none !important;
}

html[data-mode="classic"] .mode-toggle {
  border-radius: 6px;
}

html[data-mode="gamified"] .xp-bar-fill {
  transition: width 0.35s ease;
}

.challenge-reward-status {
  font-size: 0.9rem;
  color: var(--ed-neutral-600, #475569);
  margin: 0.4rem 0 0;
}

.challenge-reward-status--done {
  color: var(--ed-green-700, #166534);
  font-weight: 600;
}

.challenge-fulfill-form {
  margin-top: 0.5rem;
}

/* VK operator tickets */
.ticket-list {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.ticket-list--compact {
  gap: 0.5rem;
}

.ticket-card {
  border: 1px solid var(--ed-neutral-200, #e2e8f0);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  background: #fff;
}

.ticket-card--mine {
  border-color: var(--ed-violet-400, #a78bfa);
  background: #faf5ff;
}

.ticket-card--done {
  opacity: 0.85;
}

.ticket-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.ticket-status {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ed-violet-700, #6d28d9);
}

.ticket-contact {
  margin: 0 0 0.5rem;
  font-weight: 500;
}

.ticket-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
  font-size: 0.9rem;
}

.ticket-close-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.ticket-note {
  flex: 1;
  min-width: 12rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--ed-neutral-300, #cbd5e1);
  border-radius: 6px;
}

.ticket-note-text {
  margin: 0.25rem 0 0.5rem;
  color: var(--ed-neutral-600, #475569);
  font-size: 0.9rem;
}

.stat-pill {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 0.85rem;
  font-weight: 600;
}

.action-inbox-item--vk_ticket {
  border-left: 4px solid #7e4fdc;
}

.xp-streak {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #e9d5ff;
}

.xp-card .xp-streak {
  color: #e9d5ff;
}

.dashboard-quests {
  margin-bottom: 1.5rem;
}

.dash-quest-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 720px) {
  .dash-quest-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

.dash-quest-link {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--ed-neutral-200, #e2e8f0);
  border-radius: 10px;
  background: var(--ed-neutral-50, #f8fafc);
}

.dash-quest-link:hover {
  border-color: var(--ed-violet-400, #a78bfa);
}

.dash-quest-title {
  display: block;
  font-weight: 600;
  margin-bottom: 0.45rem;
}

.dash-quest-count {
  font-size: 0.85rem;
  color: var(--ed-neutral-600, #475569);
}

.dash-quest--done .dash-quest-link {
  background: #f0fdf4;
  border-color: #86efac;
}

.role-track {
  margin: 1.5rem 0 2rem;
}

.role-track-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.role-track-step {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  background: var(--ed-neutral-50, #f8fafc);
  opacity: 0.72;
}

.role-track-step--done {
  opacity: 1;
  background: #f0fdf4;
}

.role-track-label {
  flex: 1;
  font-weight: 500;
}

.activity-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
  align-items: end;
}

.activity-filters label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
}

.game-confetti {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 80;
  overflow: hidden;
}

.game-confetti__piece {
  position: absolute;
  top: -12px;
  width: 8px;
  height: 12px;
  border-radius: 2px;
  animation: game-confetti-fall 1.4s ease-in forwards;
}

@keyframes game-confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(420deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .game-confetti__piece { animation: none; display: none; }
}

html[data-reduce-motion="true"] .game-confetti__piece {
  animation: none;
  display: none;
}

.list-meta { color: #64748b; font-size: 0.9rem; margin: 0.5rem 0 1rem; }
.table-actions { white-space: nowrap; }
.table-actions a { margin-right: 0.65rem; }
.resume-hub-recent { margin: 0 0 1.5rem; }
.resume-hub-recent .link-list { list-style: none; margin: 0; padding: 0; }
.resume-hub-recent .link-list li { margin: 0.35rem 0; }

/* Desktop-first shell: сайдбар — колонка (push), drawer только ≤900px */
.app-shell {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
}
.app-main-col {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
.app-sidebar {
  box-sizing: border-box;
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  bottom: auto;
  right: auto;
  left: auto;
  height: auto;
  max-height: 100vh;
  max-height: 100dvh;
  align-self: flex-start;
  flex: 0 0 16rem;
  width: 16rem;
  max-width: 16rem;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.75rem 0.65rem 1.25rem;
  background: var(--ed-neutral-50, #f8fafc);
  border-right: 1px solid var(--ed-neutral-200, #e2e8f0);
  z-index: 40;
  -webkit-transform: none;
  transform: none;
  box-shadow: none;
  pointer-events: auto;
}
.app-sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  padding: 0 0.25rem;
}
.logo--sidebar { gap: 0.4rem; }
.logo--sidebar .logo-text { font-size: 0.85rem; }
.sidebar-collapse-btn,
.sidebar-open-btn,
.sidebar-close-btn {
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid var(--ed-neutral-200, #e2e8f0);
  background: #fff;
  border-radius: 8px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ed-neutral-800, #1e293b);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.sidebar-collapse-btn {
  display: inline-flex;
  position: relative;
  z-index: 2;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}
.sidebar-open-btn {
  display: none;
  align-items: center;
  gap: 0.35rem;
  margin-right: 0.5rem;
  background: var(--ed-violet-700, #6d28d9);
  border-color: var(--ed-violet-700, #6d28d9);
  color: #fff;
  font-weight: 600;
  min-height: 44px;
  padding: 0.45rem 0.75rem;
}
.sidebar-close-btn {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
}

.sidebar-focus {
  display: block;
  margin: 0 0 0.85rem;
  padding: 0.55rem 0.6rem;
  border-radius: 10px;
  background: var(--ed-violet-50, #f5f3ff);
  border: 1px solid var(--ed-violet-100, #ede9fe);
}
.sidebar-focus-label {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ed-violet-800, #5b21b6);
}
.sidebar-nav,
.sidebar-focus-nav {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.2rem;
  width: 100%;
}
.sidebar-focus-link {
  display: block;
  padding: 0.28rem 0.4rem;
  border-radius: 6px;
  color: var(--ed-neutral-800, #1e293b);
  text-decoration: none;
  font-size: 0.88rem;
}
.sidebar-focus-link:hover { background: #fff; }

.sidebar-section {
  display: block;
  width: 100%;
  margin: 0 0 0.35rem;
  border: 0;
}
.sidebar-section-summary {
  display: block;
  cursor: pointer;
  list-style: none;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ed-neutral-500, #64748b);
  padding: 0.35rem 0.4rem;
}
.sidebar-section-summary::-webkit-details-marker { display: none; }
.sidebar-section-summary::marker { content: ""; }
.sidebar-section-list {
  list-style: none;
  margin: 0;
  padding: 0 0 0.35rem;
  display: block;
  width: 100%;
}
.sidebar-link {
  display: block;
  padding: 0.32rem 0.55rem;
  border-radius: 8px;
  color: var(--ed-neutral-800, #1e293b);
  text-decoration: none;
  font-size: 0.9rem;
}
.sidebar-link:hover { background: var(--ed-neutral-100, #f1f5f9); }
.sidebar-sub { margin: 0; }
.sidebar-sub-summary { cursor: pointer; }
.sidebar-sub-summary::-webkit-details-marker { display: none; }
.sidebar-sub-summary::marker { content: ""; }
.sidebar-sub-list {
  list-style: none;
  margin: 0;
  padding: 0 0 0.35rem 0.75rem;
}
.sidebar-link--sub { font-size: 0.84rem; }
.sidebar-link.is-active {
  background: var(--ed-violet-100, #ede9fe);
  color: var(--ed-violet-900, #4c1d95);
  font-weight: 600;
}

/* Top bar: utilities only. Logo lives in the sidebar on desktop. */
body.has-sidebar header.app-topbar {
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--ed-neutral-200, #e2e8f0);
  background: #fff;
}
body.has-sidebar header.app-topbar > nav {
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 0.75rem;
}
body.has-sidebar .logo--topbar { display: none; }
body.has-sidebar .role-focus { display: none; }

.sidebar-drawer-backdrop { display: none !important; }

/* Свёртка в рейку (только desktop push-режим) */
.app-shell--collapsed .app-sidebar {
  flex-basis: 3.75rem;
  width: 3.75rem;
  max-width: 3.75rem;
  padding: 0.65rem 0.35rem;
  overflow: visible;
}
.app-shell--collapsed .logo--sidebar,
.app-shell--collapsed .logo--sidebar .logo-mark,
.app-shell--collapsed .logo--sidebar .logo-text {
  display: none !important;
  pointer-events: none !important;
}
.app-shell--collapsed .app-sidebar-brand {
  justify-content: center;
  margin-bottom: 0;
  position: relative;
  z-index: 3;
}
.app-shell--collapsed .sidebar-focus,
.app-shell--collapsed .sidebar-nav {
  display: none !important;
}
.app-shell--collapsed .sidebar-collapse-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  width: 100%;
  font-size: 1.25rem;
  font-weight: 700;
  background: var(--ed-violet-700, #6d28d9);
  color: #fff;
  border-color: var(--ed-violet-700, #6d28d9);
  z-index: 5;
}
.app-shell--collapsed .sidebar-open-btn,
body.sidebar-collapsed .sidebar-open-btn {
  display: inline-flex !important;
}
body.sidebar-collapsed header.app-topbar > nav {
  justify-content: flex-start;
}

/* Телефон / узкое окно: drawer поверх контента */
@media (max-width: 900px) {
  body.has-sidebar .logo--topbar { display: inline-flex !important; }
  body.has-sidebar header.app-topbar > nav {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  body.has-sidebar .sidebar-open-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 0.35rem;
  }
  .sidebar-collapse-btn { display: none !important; }
  .sidebar-close-btn { display: inline-flex !important; }

  .app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    height: 100vh;
    height: 100dvh;
    height: -webkit-fill-available;
    z-index: 60;
    flex: none !important;
    width: min(18rem, 88vw) !important;
    max-width: 88vw !important;
    padding-left: calc(0.65rem + env(safe-area-inset-left, 0px));
    padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
    -webkit-transform: translate3d(-110%, 0, 0);
    transform: translate3d(-110%, 0, 0);
    -webkit-transition: -webkit-transform 0.2s ease;
    transition: transform 0.2s ease;
    pointer-events: none;
    -webkit-overflow-scrolling: touch;
  }
  .app-shell--drawer-open .app-sidebar {
    -webkit-transform: translate3d(0, 0, 0) !important;
    transform: translate3d(0, 0, 0) !important;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
    pointer-events: auto;
  }
  .app-shell--collapsed .app-sidebar {
    width: min(18rem, 88vw) !important;
    max-width: 88vw !important;
    flex: none !important;
  }
  .app-shell--collapsed .logo--sidebar,
  .app-shell--collapsed .logo--sidebar .logo-mark,
  .app-shell--collapsed .logo--sidebar .logo-text {
    display: inline-flex !important;
    pointer-events: auto !important;
    width: auto !important;
    height: auto !important;
  }
  .app-shell--collapsed .sidebar-focus { display: block !important; }
  .app-shell--collapsed .sidebar-focus-nav,
  .app-shell--collapsed .sidebar-nav {
    display: flex !important;
  }

  .sidebar-drawer-backdrop {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 55;
    background: rgba(15, 23, 42, 0.35);
    -webkit-tap-highlight-color: transparent;
  }
  .sidebar-drawer-backdrop[hidden] { display: none !important; }
  .app-shell--drawer-open .sidebar-drawer-backdrop,
  body.sidebar-drawer-open .sidebar-drawer-backdrop { display: block !important; }
  html.sidebar-drawer-open,
  body.sidebar-drawer-open {
    overflow: hidden;
    touch-action: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-sidebar {
    -webkit-transition: none !important;
    transition: none !important;
  }
}

/* Filter preset chips */
.filter-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.85rem;
}
.filter-preset-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--ed-neutral-200, #e2e8f0);
  background: #fff;
  color: var(--ed-neutral-800, #1e293b);
  text-decoration: none;
  font-size: 0.86rem;
}
.filter-preset-chip:hover { border-color: var(--ed-violet-300, #c4b5fd); }
.filter-preset-chip.is-active {
  background: var(--ed-violet-700, #6d28d9);
  border-color: var(--ed-violet-700, #6d28d9);
  color: #fff;
}
.filter-preset-chip--reset { color: var(--ed-neutral-500, #64748b); }
.filter-drawer {
  margin: 0 0 1rem;
  border: 1px solid var(--ed-neutral-200, #e2e8f0);
  border-radius: 10px;
  padding: 0.35rem 0.75rem 0.75rem;
  background: var(--ed-neutral-50, #f8fafc);
}
.filter-drawer > summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.45rem 0;
}

/* One CTA + scenario overflow */
.sticky-contact-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.sticky-cta { font-weight: 600; }
.scenario-menu { position: relative; }
.scenario-menu > summary {
  list-style: none;
  cursor: pointer;
}
.scenario-menu > summary::-webkit-details-marker { display: none; }
.scenario-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 0.25rem);
  min-width: 12rem;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.4rem;
  background: #fff;
  border: 1px solid var(--ed-neutral-200, #e2e8f0);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}
.scenario-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.55rem;
  border: 0;
  background: transparent;
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}
.scenario-menu-item:hover { background: var(--ed-neutral-100, #f1f5f9); }

.case-fields-more {
  margin: 0.75rem 0 1.25rem;
  border: 1px solid var(--ed-neutral-200, #e2e8f0);
  border-radius: 10px;
  padding: 0.35rem 0.85rem 0.85rem;
}
.case-fields-more > summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.45rem 0;
}

/* aliases for template class names */
.filter-presets { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 0.85rem; }
.filter-preset-chip {
  display: inline-flex; align-items: center;
  padding: 0.28rem 0.7rem; border-radius: 999px;
  border: 1px solid var(--ed-neutral-200, #e2e8f0);
  background: #fff; color: var(--ed-neutral-800, #1e293b);
  text-decoration: none; font-size: 0.86rem;
}
.filter-preset-chip:hover { border-color: var(--ed-violet-300, #c4b5fd); }
.filter-preset-chip.is-active {
  background: var(--ed-violet-700, #6d28d9);
  border-color: var(--ed-violet-700, #6d28d9);
  color: #fff;
}
.filter-preset-chip--reset { color: var(--ed-neutral-500, #64748b); }
.app-sidebar-brand {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.35rem; margin-bottom: 0.75rem; padding: 0 0.25rem;
}
.sidebar-collapse-btn { border: 1px solid #e2e8f0; background: #fff; border-radius: 8px; padding: 0.25rem 0.5rem; cursor: pointer; }
.sidebar-section { margin: 0 0 0.35rem; }
.sidebar-section-summary {
  cursor: pointer; list-style: none; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; color: #64748b; padding: 0.35rem 0.4rem;
}
.sidebar-section-summary::-webkit-details-marker { display: none; }
.sidebar-section-list { list-style: none; margin: 0; padding: 0 0 0.35rem; }
