/* ==========================================================
   Новый дизайн — стиль отчёта школ (Baiterek).
   Подключается поверх styles.css и переопределяет оформление,
   не меняя структуру разделов.
   ========================================================== */

:root {
  --bg: #e7e8eb;
  --shell: #f5f5f4;
  --card: #ffffff;
  --bg-card: #ffffff;
  --text: #18181b;
  --text-sub: #71717a;
  --ink-2: #52525b;
  --muted: #a1a1aa;
  --border: #ececec;
  --line: #ececec;
  --hover: #f5f5f4;
  --chip: #efefee;
  --dark: #1c1c1e;
  --accent: #f0412a;
  --accent-light: #fde7e3;
  --accent-soft: #fde7e3;
  --success: #15803d;
  --good: #15803d;
  --warning: #d97706;
  --danger: #f0412a;
  --hatch: #d4d4d8;
  --radius: 22px;
  --shadow: none;
  --shadow-lg: 0 24px 60px rgba(24, 24, 27, .16), 0 0 0 1px rgba(0, 0, 0, .04);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

body {
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  height: auto;
  min-height: 100vh;
  overflow: auto;
  display: block;
}

button, input, select, textarea { font-family: inherit; }
.pos { color: var(--good) !important; }
.neg { color: var(--accent) !important; }
.empty { padding: 32px 12px; text-align: center; color: var(--muted); font-size: 13px; }
.hidden { display: none !important; }

/* ——— Бренд ——— */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; white-space: nowrap; }
.brand-mark { position: relative; width: 26px; height: 26px; flex: none; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; border-radius: 50%; }
.brand-mark::before { width: 14px; height: 14px; background: var(--accent); left: 0; top: 2px; }
.brand-mark::after { width: 10px; height: 10px; background: var(--dark); right: 1px; bottom: 1px; }
.brand-mark-lg { transform: scale(1.8); margin-bottom: 26px; animation: brandPulse 1.2s ease-in-out infinite; }
@keyframes brandPulse { 50% { transform: scale(1.6); opacity: .7; } }

/* ——— Лоадер и вход ——— */
#loader { background: var(--bg); }
.loader-text { color: var(--muted); font-weight: 500; }

#login-page { background: var(--bg); }
.login-card {
  width: 400px; max-width: calc(100vw - 32px); background: var(--shell); border: 0; border-radius: 32px;
  padding: 34px; box-shadow: none; display: flex; flex-direction: column; gap: 16px;
}
.login-card h2 { margin: 6px 0 0; font-size: 34px; font-weight: 500; letter-spacing: -.02em; text-align: left; }
.login-field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.login-card input {
  height: 42px; margin: 0; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 14px;
}
.login-card input:focus { border-color: var(--text); }
.login-card .login-btn { height: 44px; padding: 0; border-radius: 999px; background: var(--dark); font-weight: 600; }
.login-card .login-btn:hover { background: #000; opacity: 1; }
.login-error { color: var(--accent); text-align: left; min-height: 18px; margin: 0; }

/* ——— Каркас ——— */
#app {
  max-width: 1480px; margin: 20px auto; background: var(--shell); border-radius: 32px;
  padding: 18px 28px 40px; min-height: calc(100vh - 40px); height: auto;
}
.main-content { overflow: visible; padding: 0; gap: 18px; }
.main-content::after { display: none; }
.dashboard-page { gap: 14px; }

/* ——— Верхняя навигация ——— */
.top-nav {
  background: transparent; border: 0; padding: 0; margin-bottom: 26px; gap: 16px; position: relative; z-index: 50;
}
.nav-left { gap: 10px; min-width: 150px; }
.nav-tabs {
  margin: 0 auto; display: flex; gap: 2px; padding: 4px; background: var(--card); border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04); overflow-x: auto; scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tab {
  border: 0; height: 36px; padding: 0 18px; border-radius: 999px; font-size: 13px; font-weight: 600;
  color: var(--ink-2); display: flex; align-items: center; gap: 8px;
}
.nav-tab i { font-size: 12px; opacity: .75; }
.nav-tab:hover:not(.disabled) { background: var(--shell); color: var(--text); }
.nav-tab.active { background: var(--dark); color: #fff; }
.nav-tab.active i { opacity: 1; }
.nav-right { gap: 8px; min-width: 150px; justify-content: flex-end; }

.round {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--card); color: var(--text);
  display: inline-grid; place-items: center; flex: none; font-size: 15px; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}
.round:hover { background: #fafafa; }
.round.dark { background: var(--dark); color: #fff; }
.round.soft { background: var(--chip); box-shadow: none; }
.round.sm { width: 32px; height: 32px; font-size: 13px; }
.user-badge {
  height: 40px; min-width: 40px; padding: 0 14px; border-radius: 999px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .02em;
}
.nav-btn { border-radius: 999px; border: 0; background: var(--card); }
.nav-btn:hover { border-color: transparent; background: #fafafa; }

/* Мобильное меню */
.mobile-nav-panel { border-radius: 0 28px 28px 0; background: var(--shell); padding: 22px 16px; }
.mobile-nav-panel h3 { font-weight: 600; font-size: 20px; padding: 0 12px; }
.mobile-nav-item { border-radius: 999px; font-weight: 600; color: var(--ink-2); }
.mobile-nav-item:hover { background: var(--card); }
.mobile-nav-item.active { background: var(--dark); color: #fff; }
.mobile-nav-item i { width: 20px; text-align: center; margin-right: 6px; }

/* ——— Шапка раздела: крупный заголовок + период + обновление ——— */
.page-hero, .dashboard-header, .marketing-header, .corr-header {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 0; margin-bottom: 8px;
}
.page-title { font-size: 44px; font-weight: 500; letter-spacing: -.03em; margin: 0 auto 0 0; line-height: 1.05; color: var(--text); white-space: nowrap; }
.page-title span { color: var(--muted); }
.corr-header-left { margin-right: auto; gap: 8px; }
.corr-subtitle { color: var(--muted); font-size: 13px; }
.settings-page > .dashboard-header { margin-bottom: 4px; }
.settings-page > .dashboard-header .btn-outline { background: var(--card); }

.sync-info-bar { gap: 8px; }
.sync-info-label { color: var(--muted); font-size: 12px; }
.sync-info-time { font-size: 12px; font-weight: 600; }
.btn-sync-quick, .btn-sync-previews {
  height: 36px; padding: 0 16px; border-radius: 999px; font-size: 13px; font-weight: 600; gap: 8px;
}
.btn-sync-quick { background: var(--dark); color: #fff; }
.btn-sync-quick:hover { background: #000; opacity: 1; transform: none; }
.btn-sync-previews { background: var(--card); color: var(--text); border: 0; }
.btn-sync-previews:hover { background: #fafafa; opacity: 1; transform: none; }

.filter-bar, .marketing-header-right, .corr-header-right { gap: 8px; }
.filter-btn, .m-filter-btn {
  height: 36px; padding: 0 16px; border-radius: 999px; border: 0; background: var(--card); color: var(--text);
  font-size: 13px; font-weight: 600; gap: 8px; box-shadow: inset 0 0 0 1px var(--line);
}
.filter-btn:hover, .m-filter-btn:hover { border-color: transparent; box-shadow: inset 0 0 0 1px #d4d4d8; }
.filter-btn i, .m-filter-btn i { font-size: 12px; color: var(--ink-2); }

/* Выпадающие списки */
.multiselect-content { border: 0; border-radius: 18px; box-shadow: var(--shadow-lg); padding: 8px; }
.multiselect-item { border-radius: 10px; font-size: 13px; }
.multiselect-item input[type="checkbox"] { accent-color: var(--dark); }

/* ——— Календарь ——— */
#calendarModal, #pulseCalendarModal, #mCalendarModal, #crCalendarModal, #corrCalendarModal {
  border: 0; border-radius: 24px; box-shadow: var(--shadow-lg); top: 46px;
}
.cal-sidebar { background: var(--shell); border-right: 0; padding: 16px 10px; gap: 2px; }
.cal-preset-btn { border-radius: 999px; padding: 9px 14px; font-weight: 600; color: var(--ink-2); }
.cal-preset-btn:hover { background: var(--card); color: var(--text); }
.cal-month-title { font-weight: 600; }
.cal-nav:hover { color: var(--text); }
.cal-day-name { color: var(--muted); font-weight: 600; }
.cal-cell { font-weight: 500; font-variant-numeric: tabular-nums; }
.cal-cell:hover:not(.empty) { background: var(--chip); }
.cal-cell.selected { background: var(--dark) !important; color: #fff !important; }
.cal-cell.range { background: var(--accent-soft); }
.cal-footer { border-top: 1px solid var(--line); }
.cal-input-box { border-radius: 999px; border: 0; background: var(--shell); }
.btn { border-radius: 999px; height: 38px; padding: 0 18px; font-weight: 600; justify-content: center; white-space: nowrap; }
.btn-primary { background: var(--dark); color: #fff; }
.btn-primary:hover { background: #000; opacity: 1; }
.btn-outline { border: 0; background: var(--chip); color: var(--text); }
.btn-outline:hover { border-color: transparent; background: #e4e4e2; }
.btn-secondary { border: 0; border-radius: 999px; background: var(--chip); color: var(--text); height: 38px; padding: 0 16px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.btn-secondary:hover { background: #e4e4e2; }
.btn-danger { background: var(--accent-soft); color: var(--accent); }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; }

/* ——— Карточки ——— */
.card {
  background: var(--card); border: 0; border-radius: var(--radius); padding: 20px; box-shadow: none;
  justify-content: flex-start; transition: none;
}
.card:hover { transform: none; box-shadow: none; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h3 { margin: 0; font-size: 16px; font-weight: 600; flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 999px;
  background: var(--chip); color: var(--ink-2); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.chip b { color: var(--text); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* Тёмная карточка со штриховкой */
.dark-card {
  background-color: var(--dark); color: #fff; border-radius: var(--radius); padding: 20px; position: relative; overflow: visible;
  background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .04) 0 2px, transparent 2px 12px);
  display: flex; flex-direction: column; gap: 10px; min-height: 200px; min-width: 0;
}
.dark-card .t { font-size: 26px; font-weight: 400; line-height: 1.1; }
.dark-card .v { font-size: 38px; font-weight: 500; letter-spacing: -.02em; margin-top: auto; white-space: nowrap; line-height: 1.1; }
.dark-card .chips .chip { background: rgba(255, 255, 255, .1); color: rgba(255, 255, 255, .75); }
.dark-card .chips .chip b { color: #fff; }
.dark-card .tag-top { position: absolute; top: 18px; right: 18px; border: 1px solid rgba(255, 255, 255, .25); border-radius: 999px; padding: 4px 12px; font-size: 12px; display: flex; gap: 6px; align-items: center; }
.dark-card .v.pos { color: #fff !important; }
.dark-card .v.neg { color: #ff8a78 !important; }

/* Списки показателей */
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.list-row:last-child { border-bottom: 0; }
.list-row .ico { width: 30px; height: 30px; border-radius: 9px; background: var(--chip); display: grid; place-items: center; color: var(--ink-2); font-size: 12px; flex: none; }
.list-row .name { flex: 1; color: var(--ink-2); min-width: 0; }
.list-row .name small { display: block; color: var(--muted); font-size: 11px; }
.list-row b { font-weight: 600; font-variant-numeric: tabular-nums; font-size: 15px; }

/* Цифры в шапке */
.head-stats { display: flex; gap: 14px; flex-wrap: wrap; }
.head-stat { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 20px; padding: 14px 18px 14px 14px; flex: 1; min-width: 200px; }
.head-stat .round { width: 46px; height: 46px; font-size: 17px; background: var(--shell); box-shadow: none; }
.head-stat .v { font-size: 26px; font-weight: 500; letter-spacing: -.02em; line-height: 1.1; white-space: nowrap; }
.head-stat .l { font-size: 12px; color: var(--muted); }

/* Мини-плитки */
.mini-tiles { display: grid; grid-template-columns: 1fr; gap: 10px; }
.mini { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 16px; background: var(--card); min-width: 0; }
.mini .round { width: 36px; height: 36px; font-size: 13px; background: var(--shell); box-shadow: none; }
.mini .l { font-size: 11px; color: var(--muted); }
.mini .v { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mini.dark { background: var(--dark); color: #fff; }
.mini.dark .round { background: #fff; color: var(--dark); }

/* Полукруглый индикатор */
.gauge { position: relative; width: 100%; max-width: 280px; margin: 4px auto 0; }
.gauge svg { width: 100%; display: block; }
.gauge-center { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; }
.gauge-center .big { font-size: 42px; font-weight: 400; letter-spacing: -.03em; line-height: 1; color: var(--text); }
.gauge-center .l { font-size: 12px; color: var(--muted); }

/* Горизонтальные бары (штриховка, лидер — коралловый) */
.hbars { min-height: 60px; }
.tag-row { display: grid; grid-template-columns: minmax(90px, 170px) 1fr 76px; align-items: center; gap: 12px; padding: 7px 0; font-size: 13px; cursor: default; }
.tag-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); font-weight: 500; }
.tag-track { height: 14px; border-radius: 999px; background: var(--shell); overflow: hidden; }
.tag-track > div { height: 100%; border-radius: 999px; background: repeating-linear-gradient(135deg, var(--hatch) 0 2px, #f6f6f7 2px 6px); box-shadow: inset 0 0 0 1px #e4e4e7; transition: background .15s; }
.tag-row.top .tag-track > div, .tag-row:hover .tag-track > div { background: var(--accent); box-shadow: none; }
.tag-row.neg-row .tag-track > div { background: repeating-linear-gradient(135deg, #fbcfc7 0 2px, #fff4f2 2px 6px); box-shadow: inset 0 0 0 1px #fbd5ce; }
.tag-row .val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Воронка */
.funnel-bars { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.funnel-row { display: grid; grid-template-columns: 110px 1fr 56px 64px; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; }
.funnel-name { color: var(--ink-2); font-weight: 500; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.funnel-name i { width: 14px; text-align: center; color: var(--muted); font-size: 12px; }
.funnel-track { height: 22px; border-radius: 999px; background: var(--shell); overflow: hidden; }
.funnel-track > div { height: 100%; border-radius: 999px; background: repeating-linear-gradient(135deg, var(--hatch) 0 2px, #f6f6f7 2px 6px); box-shadow: inset 0 0 0 1px #e4e4e7; }
.funnel-row.last .funnel-track > div, .funnel-row:hover .funnel-track > div { background: var(--accent); box-shadow: none; }
.funnel-row b { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.funnel-cv { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* Подсказки */
.hover-tip {
  position: fixed; z-index: 9500; transform: translate(-50%, -100%); pointer-events: none; min-width: 170px; max-width: 320px;
  background: var(--dark); color: #fff; font-size: 12px; padding: 10px 12px; border-radius: 14px; box-shadow: 0 10px 28px rgba(0, 0, 0, .25);
}
.hover-tip b { display: block; font-size: 13px; margin-bottom: 6px; }
.hover-tip div { display: flex; justify-content: space-between; gap: 14px; line-height: 1.6; }
.hover-tip span { color: #a1a1aa; }
.hover-tip em { font-style: normal; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
[data-tooltip-full]::after, .kzt-tooltip:hover::after {
  background: var(--dark); color: #fff; border-radius: 999px; padding: 5px 12px; font-size: 12px; box-shadow: 0 8px 20px rgba(0, 0, 0, .2);
}
[data-tooltip-full]::before, .kzt-tooltip:hover::before { border-top-color: var(--dark); }
.dark-card[data-tooltip-full]::after { bottom: auto; top: calc(100% + 6px); }
.dark-card[data-tooltip-full]::before { display: none; }
.dark-card [data-tooltip-full]::after, .list-row[data-tooltip-full]::after, .list-row[data-tooltip-full]::before { display: none; }
.apexcharts-tooltip.apexcharts-theme-dark { background: var(--dark) !important; border: 0 !important; border-radius: 12px !important; box-shadow: 0 10px 28px rgba(0, 0, 0, .25) !important; }
.apexcharts-tooltip.apexcharts-theme-dark .apexcharts-tooltip-title { background: transparent !important; border-bottom: 1px solid rgba(255, 255, 255, .1) !important; }
.apexcharts-tooltip:has(.m-chart-tooltip), .apexcharts-tooltip:has(.corr-tooltip) { background: transparent !important; box-shadow: none !important; border: 0 !important; }
.m-chart-tooltip, .corr-tooltip { background: var(--dark); border-radius: 14px; }
.apexcharts-title-text { font-family: var(--font) !important; }

/* ——— Отдел продаж ——— */
.sales-grid { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr) minmax(300px, 1.3fr); gap: 14px; }
.sales-grid > * { min-width: 0; }
.gauge-card { justify-content: space-between; }
.kpi-list-card { padding-bottom: 10px; }
.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ——— Таблицы ——— */
.table-cont, .m-table-cont, .pulse-scroll-wrap {
  background: var(--card); border: 0; border-radius: var(--radius); box-shadow: none; padding: 6px 8px; margin-bottom: 0;
}
.m-table-cont { overflow-x: auto; }
.m-table-cont table { table-layout: auto; min-width: 1100px; }
.m-table-cont thead th { white-space: nowrap; padding: 8px 10px; }
.m-table-cont thead th .fa-sort { opacity: .35; font-size: 9px; margin-left: 2px; }
.m-table-cont thead th:first-child, .m-table-cont tbody td:first-child { min-width: 240px; width: auto; }
.cr-table-cont thead th:first-child, .cr-table-cont tbody td:first-child { min-width: 64px; width: 64px; }
.cr-table-cont thead th:nth-child(2), .cr-table-cont tbody td:nth-child(2), .cr-table-cont thead th:nth-child(3), .cr-table-cont tbody td:nth-child(3) { text-align: left; }
.cr-table-cont tbody td:nth-child(2) { font-weight: 600; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
th, .m-table-cont thead th {
  background: var(--card); color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  border-bottom: 1px solid var(--line); height: 44px; padding: 8px 6px; line-height: 1.2;
}
th:first-child, .m-table-cont thead th:first-child { background: var(--card); }
td, .m-table-cont tbody td { font-size: 12px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; padding: 11px 8px; }
td:first-child, th:first-child { border-right: 0; box-shadow: none !important; }
.m-table-cont thead th:first-child, .m-table-cont tbody td:first-child { box-shadow: none; }
.row-main { font-weight: 600; }
.row-main:hover, .m-table-cont tbody tr:hover, .m-row-toggle:hover { background: var(--shell); }
.row-main:hover td:first-child, .m-table-cont tbody tr:hover td:first-child { background: var(--shell); }
.row-sub, .m-level-2, .m-level-3 { background: #fafaf9; }
.row-sub td:first-child { background: #fafaf9; }
.m-level-3 { color: var(--ink-2); }
.toggle-icon, .m-toggle-icon { color: var(--muted); }
tfoot td, .m-table-cont tfoot td { background: var(--shell); border-top: 0; font-weight: 700; }
tfoot td:first-child { background: var(--shell); }
.m-romi-positive { color: var(--good); }
.m-romi-negative { color: var(--accent); }

/* ——— Маркетинг ——— */
.marketing-light-page { border-radius: 0; }
.m-head-stats { margin-bottom: 0; }
.m-kpi-container { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(250px, .8fr); gap: 14px; }
.m-kpi-card.m-kpi-chart-card, .card.m-kpi-chart-card { grid-column: auto; grid-row: auto; padding: 20px; }
.m-side-stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.m-romi-card { min-height: 170px; flex: 1; }

/* ——— Креативы ——— */
.cr-kpi-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; }
.cr-funnel-kpi { gap: 28px; margin-bottom: 8px; }
.cr-kpi-sublabel { font-size: 11px; font-weight: 500; color: var(--muted); text-transform: none; letter-spacing: 0; }
.cr-kpi-big { font-size: 24px; font-weight: 500; letter-spacing: -.02em; }
.cr-kpi-big.accent { color: var(--accent); }
.cr-money-card .cr-kpi-sublabel { color: rgba(255, 255, 255, .55); }
.cr-money-row { margin: auto 0 4px; gap: 12px; }
.cr-money-val { font-size: 28px; font-weight: 500; letter-spacing: -.02em; color: #fff; white-space: nowrap; }
.cr-money-val.muted-val { color: rgba(255, 255, 255, .6); }
.cr-progress-bar { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, .1); gap: 3px; margin-bottom: 10px; }
.cr-progress-bar > div { border-radius: 999px; }
#cr-pb-rev { background: var(--accent); }
#cr-pb-spd { background: repeating-linear-gradient(135deg, rgba(255, 255, 255, .45) 0 2px, rgba(255, 255, 255, .15) 2px 6px); }
.cr-metrics-grid { gap: 6px; }
.cr-metric-pill { border: 0; border-radius: 14px; background: rgba(255, 255, 255, .08); padding: 8px 6px; }
.cr-pill-label { color: rgba(255, 255, 255, .55); font-size: 10px; font-weight: 600; }
.cr-pill-val { color: #fff; font-weight: 600; }
.cr-romi-list { max-height: 260px; overflow-y: auto; padding-right: 4px; }
.cr-romi-list .tag-row { grid-template-columns: minmax(80px, 1fr) 1fr 56px; }
.cr-img-box { border: 0; border-radius: 10px; background: var(--chip); }
.cr-creo-img { border-radius: 10px; }
.cr-active-on, .cr-active-off { border-radius: 999px; padding: 3px 10px; font-weight: 600; }
.cr-active-on { background: #dcfce7; color: var(--good); }
.cr-active-off { background: var(--chip); color: var(--muted); }

/* ——— Пульс ОП ——— */
.pulse-scroll-wrap { padding: 0; overflow-x: auto; }
.pulse-header-cell, .pulse-header-cell.pulse-cell-manager { background: var(--card) !important; color: var(--muted); font-weight: 600; font-size: 10px; letter-spacing: .04em; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); height: 40px; }
.pulse-cell { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.pulse-cell-hour { border-left: 0; }
.pulse-cell-day { background: #fafaf9; border-left: 0; }
.pulse-cell-month { background: var(--shell); border-left: 0; }
.pulse-manager-row:hover .pulse-cell { background: var(--shell); }
.pulse-avatar-initials { background: var(--dark); }
.pulse-stat-row.active-calls span { color: var(--text); }
.pulse-stat-row.active-sale, .pulse-sale-badge, .pulse-sale-badge-day { background: var(--accent-soft); border-radius: 999px; }
.pulse-stat-row.active-sale i, .pulse-stat-row.active-sale span, .pulse-sale-badge, .pulse-sale-badge-day, .pulse-day-sale-zero { color: var(--accent); }
.pulse-plan-bar-wrap { height: 6px; border-radius: 999px; background: var(--chip); }
.pulse-plan-bar { border-radius: 999px; }
.pulse-month-revenue { font-weight: 700; }
.pulse-calls-in { color: var(--text); }

/* ——— Академ ——— */
.academic-kpis { display: flex; }
.charts-grid-academic { gap: 14px; }
.charts-grid-academic .card { padding: 18px 14px 10px; }

/* ——— Корреляции ——— */
.corr-granularity { border: 0; border-radius: 999px; background: var(--card); padding: 3px; gap: 2px; box-shadow: inset 0 0 0 1px var(--line); }
.corr-gran-btn { border-radius: 999px; height: 30px; padding: 0 14px; font-weight: 600; }
.corr-gran-btn.active { background: var(--dark); color: #fff; }
.corr-charts-grid { gap: 14px; padding-bottom: 0; }
.corr-card { background: var(--card); border: 0; border-radius: var(--radius); padding: 18px 16px 8px; }
.corr-card:hover { box-shadow: none; border-color: transparent; }
.corr-empty-state { background: var(--shell); border-radius: 16px; font-style: normal; color: var(--muted); }
.corr-tooltip-title { color: #d4d4d8; }

/* ——— Настройки ——— */
.settings-tabs { border-bottom: 0; gap: 2px; padding: 4px; background: var(--card); border-radius: 999px; width: fit-content; max-width: 100%; overflow-x: auto; margin-bottom: 4px; }
.settings-tab { border: 0; margin: 0; border-radius: 999px; height: 36px; padding: 0 16px; font-weight: 600; color: var(--ink-2); }
.settings-tab:hover { color: var(--text); }
.settings-tab.active { background: var(--dark); color: #fff; border: 0; }
.settings-section { background: var(--card); border: 0; border-radius: var(--radius); box-shadow: none; padding: 22px; margin-bottom: 14px; }
.settings-section h3 { font-size: 16px; font-weight: 600; }
.settings-section h3 i { color: var(--muted); }
.setting-field label { font-size: 12px; font-weight: 600; color: var(--ink-2); text-transform: none; letter-spacing: 0; }
.setting-field input, .setting-field select, .settings-section input, .settings-section select {
  height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); padding: 0 14px;
}
.setting-field input:focus, .setting-field select:focus { border-color: var(--text); }
.setting-field.title-row { border-bottom: 0 !important; font-weight: 600 !important; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.user-row { border: 0; border-radius: 14px; background: var(--shell); }
.user-role { border-radius: 999px; background: var(--chip); color: var(--ink-2); }
.sync-status-bar { border: 0; border-radius: 14px; background: var(--shell); }
.sync-dot { background: #22c55e; }

/* ——— Уведомления ——— */
.toast { border-radius: 14px; background: var(--dark); box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
.toast.success { background: var(--dark); }
.toast.info { background: var(--dark); }
.toast.error { background: var(--accent); }

/* ——— Адаптивность ——— */
@media (max-width: 1240px) {
  .sales-grid { grid-template-columns: 1fr 1fr; }
  .sales-grid > .kpi-list-card { grid-column: 1 / -1; }
  .kpi-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; }
  .kpi-list .list-row:nth-last-child(2) { border-bottom: 0; }
  .m-kpi-container { grid-template-columns: 1fr 1fr; }
  .m-side-stack { grid-column: 1 / -1; flex-direction: row; }
  .m-side-stack > * { flex: 1; }
  .cr-kpi-grid { grid-template-columns: 1fr 1fr; }
  .cr-kpi-grid > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 1100px) {
  .top-nav { flex-wrap: wrap; }
  .nav-tabs { order: 3; width: 100%; margin: 0; }
  .nav-left, .nav-right { min-width: 0; }
  .nav-right { margin-left: auto; }
}
@media (max-width: 900px) {
  .page-title { font-size: 34px; white-space: normal; flex-basis: 100%; }
  .dashboard-header, .page-hero { flex-direction: row; align-items: center; }
  .charts-row { grid-template-columns: 1fr; }
  .m-kpi-container { grid-template-columns: 1fr; }
  .m-side-stack { flex-direction: column; }
}
@media (max-width: 760px) {
  #app { margin: 0; border-radius: 0; padding: 14px 16px 40px; min-height: 100vh; }
  .top-nav { margin-bottom: 18px; }
  .nav-tabs { display: none; }
  .mobile-menu-btn { display: inline-grid !important; }
  .page-title { font-size: 30px; }
  .sales-grid { grid-template-columns: 1fr; }
  .kpi-list { display: block; }
  .head-stat { min-width: calc(50% - 7px); padding: 12px; }
  .head-stat .v { font-size: 20px; }
  .head-stat .round { width: 38px; height: 38px; font-size: 14px; }
  .cr-kpi-grid { grid-template-columns: 1fr; }
  .tag-row { grid-template-columns: 96px 1fr 60px; }
  .funnel-row { grid-template-columns: 92px 1fr 44px 52px; }
  .filter-bar, .marketing-header-right { flex-wrap: wrap; }
  .sync-info-bar { flex-wrap: wrap; }
  .dark-card .v { font-size: 30px; }
}
@media (max-width: 420px) {
  .head-stat { min-width: 100%; }
}

/* Заголовки таблиц: перенос по слогам вместо разрыва слова посередине */
th { word-wrap: normal; overflow-wrap: normal; hyphens: auto; -webkit-hyphens: auto; }
#academic-table th { letter-spacing: .02em; }

/* ==========================================================
   v2: логотип ERA, шапка/период/обновление как в отчёте школ
   ========================================================== */
.brand-logo { height: 26px; width: auto; display: block; }
.login-card .brand-logo { height: 30px; }
.brand-sub { color: var(--muted); font-weight: 600; font-size: 14px; }
.loader-logo { height: 46px; width: auto; margin-bottom: 22px; animation: brandPulse 1.2s ease-in-out infinite; }
@keyframes brandPulse { 50% { opacity: .55; transform: scale(.96); } }

/* Шапка: заголовок и цифры сверху, пресеты периода, фильтры и статус обновления — строкой ниже */
.page-hero { margin-bottom: 10px; }
.page-hero > .hero-top { flex: 0 0 100%; display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 6px; }
.hero-top .page-title { margin: 0; }
.hero-top .head-stats { flex-wrap: nowrap; gap: 28px; }
.hero-top .head-stat { background: transparent; padding: 0; min-width: 0; flex: none; border-radius: 0; }
.hero-top .head-stat .round { background: var(--card); box-shadow: 0 1px 2px rgba(0, 0, 0, .05); }
.hero-top .head-stat .v { display: flex; align-items: center; gap: 8px; }
.hero-top .head-stat[data-tooltip-full]::after { bottom: auto; top: calc(100% + 6px); }
.hero-top .head-stat[data-tooltip-full]::before { display: none; }
.page-hero > .period-chips { order: 1; }
.page-hero > .filter-bar, .page-hero > .marketing-header-right { order: 2; }
.page-hero > .sync-line { order: 3; margin-left: auto; }
.badge-accent { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; white-space: nowrap; letter-spacing: 0; }
.badge-good { background: var(--good); }
.badge-flat { background: var(--chip); color: var(--ink-2); }

/* Старые элементы периода/обновления остаются в разметке для совместимости, но скрыты */
.page-hero > .sync-info-bar,
#date-range-btn, #m-date-range-btn, #cr-date-range-btn, #pulse-date-range-btn,
#calendarModal, #pulseCalendarModal, #mCalendarModal, #crCalendarModal { display: none !important; }

/* Чипы периода */
.period-chips .chip { height: 32px; padding: 0 14px; border: 0; cursor: pointer; }
.period-chips .chip:hover { color: var(--text); }
.period-chips .chip.active { background: var(--dark); color: #fff; }
.cal-chip { color: var(--text) !important; background: var(--card) !important; box-shadow: inset 0 0 0 1px var(--line); }
.cal-chip.active { background: var(--dark) !important; color: #fff !important; box-shadow: none; }
.filter-btn, .m-filter-btn { height: 32px; font-size: 12px; }

/* Статус обновления */
.sync-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.status-pill { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; background: var(--chip); color: var(--ink-2); white-space: nowrap; }
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.status-pill.ok::before { background: #22c55e; }
.status-pill.err::before { background: var(--accent); }
.status-pill.run::before { background: #f59e0b; animation: pulse 1s infinite; }
.btn-sync { background: var(--dark); color: #fff; height: 32px; }
.btn-sync:hover { background: #000; }
.btn-sync:disabled { opacity: .6; cursor: default; }

/* Календарь (как в школах) */
.cal-pop {
  position: absolute; z-index: 7000; display: flex; background: var(--card); border-radius: 24px;
  box-shadow: 0 24px 60px rgba(24, 24, 27, .18), 0 0 0 1px rgba(0, 0, 0, .04); overflow: hidden; font-size: 14px;
}
.cal-pop .cal-side { display: flex; flex-direction: column; gap: 2px; padding: 16px 10px; background: var(--shell); min-width: 170px; width: auto; border: 0; }
.cal-preset { border: 0; background: transparent; text-align: left; padding: 9px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; cursor: pointer; }
.cal-preset:hover { background: var(--card); color: var(--text); }
.cal-preset.active { background: var(--dark); color: #fff; }
.cal-main { position: relative; padding: 18px 20px 16px; }
.cal-pop .cal-nav { position: absolute; top: 14px; left: 16px; right: 16px; display: flex; justify-content: space-between; pointer-events: none; padding: 0; }
.cal-pop .cal-nav button { pointer-events: auto; }
.cal-pop .cal-nav button:disabled { opacity: .35; cursor: default; }
.cal-months { display: flex; gap: 28px; }
.cal-month { width: 252px; }
.cal-title { text-align: center; font-weight: 600; font-size: 14px; height: 32px; line-height: 32px; margin-bottom: 8px; }
.cal-pop .cal-grid { display: grid; grid-template-columns: repeat(7, 36px); row-gap: 2px; gap: 2px 0; }
.cal-wd { text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); height: 28px; line-height: 28px; }
.cal-day { position: relative; width: 36px; height: 36px; border: 0; background: transparent; font-size: 13px; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; z-index: 0; cursor: pointer; padding: 0; }
.cal-day::before { content: ""; position: absolute; inset: 3px; border-radius: 50%; z-index: -1; transition: background .1s; }
.cal-day:hover:not(.off)::before { background: var(--chip); }
.cal-day.in { background: var(--accent-soft); }
.cal-day.lo { border-radius: 50% 0 0 50%; }
.cal-day.hi { border-radius: 0 50% 50% 0; }
.cal-day.lo.hi { border-radius: 50%; background: transparent; }
.cal-day.lo, .cal-day.hi { color: #fff; }
.cal-day.lo::before, .cal-day.hi::before, .cal-day.lo:hover::before, .cal-day.hi:hover::before { background: var(--dark); inset: 2px; }
.cal-pop .cal-grid > :nth-child(7n + 1).in:not(.lo) { border-radius: 50% 0 0 50%; }
.cal-pop .cal-grid > :nth-child(7n).in:not(.hi) { border-radius: 0 50% 50% 0; }
.cal-day.today::after { content: ""; position: absolute; bottom: 5px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--accent); }
.cal-day.off { color: #d4d4d8; cursor: default; }
.cal-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.cal-range { flex: 1; display: flex; flex-direction: column; font-size: 11px; }
.cal-range .muted { color: var(--muted); }
.cal-range b { font-size: 14px; font-weight: 600; }

@media (max-width: 1100px) {
  .page-hero > .hero-top { flex-direction: column; align-items: stretch; gap: 14px; }
  .hero-top .head-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
  .hero-top .head-stat { background: var(--card); border-radius: 18px; padding: 12px; }
  .hero-top .head-stat .round { background: var(--shell); box-shadow: none; }
  .page-hero > .sync-line { margin-left: 0; flex-basis: 100%; }
}
@media (max-width: 760px) {
  .hero-top .head-stats { grid-template-columns: 1fr 1fr; }
  .hero-top .head-stat .v { font-size: 18px; flex-wrap: wrap; }
  .cal-pop { position: fixed; left: 0 !important; right: 0; bottom: 0; top: auto !important; border-radius: 24px 24px 0 0; flex-direction: column; max-height: 90vh; overflow: auto; }
  .cal-pop .cal-side { flex-direction: row; overflow-x: auto; padding: 12px; min-width: 0; }
  .cal-months > .cal-month:first-child { display: none; }
  .cal-month { width: 100%; }
  .cal-pop .cal-grid { grid-template-columns: repeat(7, 1fr); }
  .cal-day { width: 100%; }
  .cal-foot { flex-wrap: wrap; }
  .cal-range { flex-basis: 100%; }
}

/* ——— Пульс: столбец «Месяц» — читаемый текст и бар плана в общей гамме ——— */
.pulse-grid { grid-template-columns: minmax(180px, 1.2fr) repeat(10, minmax(72px, 1fr)) minmax(100px, .9fr) minmax(178px, 1.7fr); }
.pulse-cell.pulse-cell-month { background: var(--card) !important; border-left: 1px solid var(--line); padding: 10px 12px; gap: 6px; justify-content: center; align-items: stretch; }
.pulse-total-row .pulse-cell.pulse-cell-month { background: var(--shell) !important; }
.pm-stats { display: flex; flex-direction: column; gap: 1px; }
.pm-stats div { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; line-height: 1.5; }
.pm-stats span { color: var(--text-sub); }
.pm-stats b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.pm-revenue { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 2px; }
.pm-revenue b { font-size: 14px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pm-pct { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.pm-pct.done { background: var(--dark); color: #fff; }
.pm-pct.mid { background: var(--chip); color: var(--text); }
.pm-pct.low { background: var(--accent-soft); color: var(--accent); }
.pm-bar { height: 8px; border-radius: 999px; overflow: hidden; background: repeating-linear-gradient(135deg, var(--hatch) 0 2px, #f6f6f7 2px 6px); box-shadow: inset 0 0 0 1px #e4e4e7; }
.pm-bar > div { height: 100%; border-radius: 999px; }
.pm-bar > .done { background: var(--dark); }
.pm-bar > .mid { background: var(--ink-2); }
.pm-bar > .low { background: var(--accent); }
.pm-plan { font-size: 11px; color: var(--text-sub); line-height: 1.3; }
.pm-plan em { display: block; font-style: normal; color: var(--muted); font-size: 10px; }

/* ——— Академ карьера ——— */
.career-hero { margin-top: 18px; }
.page-title.section-title { font-size: 34px; }
.career-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 14px; }
#career-table { min-width: 640px; }
#career-table th:first-child, #career-table td:first-child { width: 320px; }
@media (max-width: 900px) { .career-grid { grid-template-columns: 1fr; } }

/* ——— Академ: таблицы помещаются в экран, цифры строго под заголовками ——— */
#academic-table, #career-table { table-layout: fixed; width: 100%; }
#academic-table { min-width: 1150px; } /* на ноутбуке и шире — без горизонтальной прокрутки */
#academic-table th, #career-table th { text-align: center; white-space: normal; height: auto; padding: 10px 4px; line-height: 1.25; }
#academic-table th { font-size: 9.5px; letter-spacing: .02em; }
#academic-table td, #career-table td { text-align: center; padding: 10px 4px; }
#academic-table th:first-child, #academic-table td:first-child,
#career-table th:first-child, #career-table td:first-child { text-align: left; padding-left: 12px; }
#academic-table th:first-child, #academic-table td:first-child { width: 210px; }
#academic-table td:first-child, #career-table td:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ——— Отдел продаж: цифры по центру под заголовками ——— */
#page-sales table th, #page-sales table td { text-align: center; }
#page-sales table th:first-child, #page-sales table td:first-child { text-align: left; padding-left: 12px; }
#page-sales table td:not(:first-child) { white-space: nowrap; }
