/* Финансовая CRM v2 (26.08.2026): ростер, скоркард, стресс, лимиты, цели,
   подписки, таймлайн, лента, тур, колокольчик, демо, отчёт + печать. */

/* Контент по центру на широких мониторах (сетка отдаёт колонке всю ширину) */
.page { margin: 0 auto; }

/* Бренд с SVG-лого */
.brand { display: flex; align-items: center; gap: 9px; }
.brand-logo { flex: none; border-radius: 7px; }

/* Сайдбар: навигация сверху, инструменты под ней, пружина, футер внизу.
   Инструменты — в стиле пунктов меню, чтобы колонка читалась единым списком. */
.nav { flex: none; }
.sidebar-spacer { flex: 1; }
.sidebar-mid {
  border-top: 1px solid var(--border);
  padding-top: 10px; margin-top: 10px;
  display: flex; flex-direction: column; gap: 2px;
}
.side-tool {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px;
  border: none; background: none; cursor: pointer;
  color: var(--text); font: inherit; font-weight: 500;
  text-align: left; width: 100%; position: relative;
}
.side-tool:hover { background: var(--surface-2); }
.side-tool .bell-badge { margin-left: auto; }
.side-tool .switch { margin-left: auto; }
.bell-badge {
  background: var(--negative); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 10px; padding: 1px 6px; min-width: 18px; text-align: center;
}

/* Переключатель демо-режима */
.switch { position: relative; display: inline-block; width: 34px; height: 20px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%;
  margin: 0; cursor: pointer; z-index: 1; }
.switch i {
  position: absolute; inset: 0; border-radius: 10px;
  background: var(--border-strong); transition: background .15s;
}
.switch i::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: left .15s;
}
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { left: 16px; }

.bell-panel {
  position: fixed; left: 244px; z-index: 60;
  width: 360px; max-height: 70vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px;
}
.bell-title { font-weight: 700; padding: 6px 10px; }
.bell-item {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 8px 10px; border-radius: 8px; color: var(--text); font-size: 13px;
}
.bell-item:hover { background: var(--surface-2); }
.bell-kind { flex: none; width: 8px; height: 8px; border-radius: 50%;
  margin-top: 5px; background: var(--border-strong); }
.bell-kind-alert { background: var(--negative); }
.bell-kind-expense { background: var(--cat-2); }
.bell-kind-question { background: var(--cat-3); }
.bell-kind-task { background: var(--accent); }
.bell-body { flex: 1; min-width: 0; }
.bell-when { flex: none; color: var(--text-soft); font-size: 12px; }

/* Демо-плашка */
body.demo-on .page::before {
  content: 'ДЕМО-РЕЖИМ — данные вымышленные';
  display: block; margin-bottom: 14px; padding: 7px 12px;
  background: #FFF6E5; border: 1px solid #E8D5A8; border-radius: 8px;
  color: #7A5C1E; font-size: 12.5px; font-weight: 600; letter-spacing: .3px;
}

/* Футер сайдбара: кнопки списком, как навигация */
.sidebar-actions { flex-direction: column; gap: 2px; }
.sidebar-foot { border-top: 1px solid var(--border); }

/* Диалог настроек */
.dialog-sub { margin: -6px 0 12px; color: var(--text-soft); font-size: 12.5px; }

/* ── Ростер ─────────────────────────────────────────────────────────── */
.page-head .search {
  border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 8px 12px; font: inherit; width: 220px; background: var(--surface);
}
.roster-card { padding: 6px 0; }
.table-scroll { overflow-x: auto; }
.roster { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.roster th {
  text-align: left; padding: 10px 14px; color: var(--text-soft);
  font-size: 12px; font-weight: 600; border-bottom: 1px solid var(--border);
  cursor: pointer; user-select: none; white-space: nowrap;
}
.roster th:hover { color: var(--text); }
.roster th.sorted { color: var(--accent); }
.roster td { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.roster tr:last-child td { border-bottom: none; }
.roster th.num, .roster td.num { text-align: right; }
.roster-row { cursor: pointer; }
.roster-row:hover { background: var(--surface-2); }
.score {
  display: inline-block; min-width: 34px; text-align: center;
  padding: 3px 8px; border-radius: 8px; font-weight: 700; font-size: 13px;
}
.score-good { background: var(--accent-soft); color: var(--accent); }
.score-mid { background: #FFF3DB; color: #8A6116; }
.score-bad { background: var(--negative-soft); color: var(--negative); }

/* ── Скоркард здоровья ──────────────────────────────────────────────── */
.card-title-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.card-title-row h2 { font-size: 16px; }
.card-title-row .spacer { flex: 1; }
.health-grid {
  display: grid; grid-template-columns: auto repeat(5, 1fr); gap: 14px;
  align-items: center;
}
.health-score { text-align: center; padding: 10px 18px; border-radius: 12px; }
.health-score-num { font-size: 34px; font-weight: 700; line-height: 1.1; }
.health-score-sub { font-size: 11.5px; color: var(--text-soft); }
.health-metric-label { color: var(--text-soft); font-size: 12px; }
.health-metric-value { font-weight: 700; font-size: 16.5px; margin-top: 2px; }
.health-metric-value .dash-delta { font-size: 12px; font-weight: 600; }

/* ── Стресс-светофор ────────────────────────────────────────────────── */
.stress-card { margin-top: 14px; }
.stress-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stress-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2);
}
.stress-light { flex: none; width: 12px; height: 12px; border-radius: 50%; margin-top: 3px; }
.stress-green .stress-light { background: #1F9D62; box-shadow: 0 0 0 4px rgba(31,157,98,.15); }
.stress-yellow .stress-light { background: #D9A421; box-shadow: 0 0 0 4px rgba(217,164,33,.15); }
.stress-red .stress-light { background: var(--negative); box-shadow: 0 0 0 4px rgba(178,59,49,.15); }
.stress-title { font-weight: 600; font-size: 13px; }
.stress-text { color: var(--text-soft); font-size: 12.5px; margin-top: 2px; }

/* ── Лимиты ─────────────────────────────────────────────────────────── */
.extra-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.limits { display: flex; flex-direction: column; gap: 10px; }
.limit-row {
  display: grid; grid-template-columns: 150px 1fr auto; gap: 10px;
  align-items: center; cursor: pointer; border-radius: 8px; padding: 4px 6px;
}
.limit-row:hover { background: var(--surface-2); }
.limit-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.limit-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.limit-fill { height: 100%; background: var(--accent); border-radius: 4px; }
.limit-fill.near { background: #D9A421; }
.limit-fill.over { background: var(--negative); }
.limit-nums { font-size: 12.5px; white-space: nowrap; }
.limit-nums.over { color: var(--negative); font-weight: 700; }
.limit-nums.near { color: #8A6116; font-weight: 600; }

/* ── Цели ───────────────────────────────────────────────────────────── */
.goals { display: flex; flex-direction: column; gap: 14px; }
.goal-head { display: flex; align-items: center; gap: 8px; }
.goal-head .spacer { flex: 1; }
.goal-pct { font-weight: 700; color: var(--accent); }
.goal-bar { height: 10px; background: var(--border); border-radius: 5px;
  overflow: hidden; margin: 6px 0 4px; }
.goal-fill { height: 100%; background: var(--accent); border-radius: 5px; }
.goal-fill.done { background: #1F9D62; }
.goal-foot { color: var(--text-soft); font-size: 12.5px; }
.goal-slider { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.goal-slider input { flex: 1; accent-color: var(--accent); }
.goal-whatif { min-width: 180px; }

/* ── Подписки + календарь ───────────────────────────────────────────── */
.subs { display: flex; flex-direction: column; gap: 8px; }
.sub-row {
  display: flex; align-items: center; gap: 8px; font-size: 13.5px;
  padding: 7px 8px; border-radius: 8px; background: var(--surface-2);
}
.sub-row .spacer { flex: 1; }
.cal-title { margin: 16px 0 8px; font-weight: 600; font-size: 13.5px;
  display: flex; gap: 10px; align-items: center; }
.cal-chart { width: 100%; height: 80px; display: block; }

/* ── Таймлайн ───────────────────────────────────────────────────────── */
.tasks { display: flex; flex-direction: column; gap: 6px; }
.task-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; background: var(--surface-2);
}
.task-row.done .task-title { text-decoration: line-through; color: var(--text-soft); }
.task-row input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
.task-row .spacer { flex: 1; }
.note-form { display: flex; gap: 8px; margin-bottom: 14px; }
.note-form select { width: auto; flex: none; }
.note-form input { flex: 1; width: auto; }
.timeline { display: flex; flex-direction: column; }
.tl-item {
  display: flex; gap: 12px; padding: 10px 4px;
  border-bottom: 1px solid var(--border); align-items: flex-start;
}
.tl-item:last-child { border-bottom: none; }
.tl-ico { flex: none; width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-soft); display: flex; align-items: center;
  justify-content: center; font-size: 15px; }
.tl-body { flex: 1; min-width: 0; }
.tl-meta { color: var(--text-soft); font-size: 12px; }
.tl-text { margin-top: 2px; white-space: pre-wrap; }
.tl-del { opacity: 0; transition: opacity .15s; }
.tl-item:hover .tl-del { opacity: 1; }
.check-label { display: flex !important; align-items: center; gap: 8px; }
.check-label input { width: auto !important; margin: 0 !important; }

/* ── Лента распознавания ────────────────────────────────────────────── */
.inbox { display: flex; flex-direction: column; gap: 12px; }
.inbox-item {
  display: flex; gap: 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.inbox-ico { flex: none; width: 38px; height: 38px; border-radius: 50%;
  background: var(--accent-soft); display: flex; align-items: center;
  justify-content: center; font-size: 17px; }
.inbox-main { flex: 1; min-width: 0; }
.inbox-head { font-size: 13.5px; }
.inbox-text { margin-top: 4px; color: var(--text-soft); font-size: 13px; }
.inbox-thumb {
  margin-top: 8px; max-height: 120px; max-width: 220px; border-radius: 8px;
  border: 1px solid var(--border); cursor: zoom-in; display: block;
}
.inbox-exp { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.inbox-exp-row {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 5px 10px; font-size: 13px;
}
.inbox-noexp { margin-top: 6px; font-size: 12.5px; }
.lightbox { display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 10px; }

/* ── Тур ────────────────────────────────────────────────────────────── */
.tour-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(26, 36, 32, .45);
}
.tour-spot {
  position: relative; z-index: 95;
  box-shadow: 0 0 0 4px var(--accent), 0 0 0 9999px rgba(26, 36, 32, .45);
  border-radius: 10px;
}
.tour-popup {
  position: fixed; z-index: 100; width: min(420px, calc(100vw - 24px));
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px;
}
.tour-step { color: var(--text-soft); font-size: 12px; margin-bottom: 4px; }
.tour-popup h3 { font-size: 16px; margin-bottom: 6px; }
.tour-popup p { margin: 0 0 14px; color: var(--text-soft); font-size: 13.5px; }
.tour-actions { display: flex; gap: 8px; align-items: center; }
.tour-actions .spacer { flex: 1; }

/* ── Отчёт ──────────────────────────────────────────────────────────── */
.report-actions { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.report {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 32px 36px; max-width: 860px;
}
.report-head { display: flex; justify-content: space-between; align-items: flex-start;
  border-bottom: 2px solid var(--accent); padding-bottom: 16px; margin-bottom: 20px; }
.report-brand { display: flex; align-items: center; gap: 8px;
  color: var(--accent); font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.report-head h1 { font-size: 24px; }
.report-score { text-align: center; padding: 10px 20px; border-radius: 12px; }
.report-score-num { font-size: 38px; font-weight: 700; line-height: 1; }
.report-score-sub { font-size: 11px; color: var(--text-soft); }
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.report-wide { grid-column: 1 / -1; }
.report h3 { font-size: 14px; margin-bottom: 10px; color: var(--accent); }
.report-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.report-table td { padding: 6px 4px; border-bottom: 1px solid var(--border); }
.report-table td:nth-child(2) { font-weight: 700; text-align: right; }
.report-table td:nth-child(3) { text-align: right; font-size: 12px; }
.report-cats { display: flex; flex-direction: column; gap: 7px; }
.report-cat { display: grid; grid-template-columns: 140px 1fr auto; gap: 8px;
  align-items: center; font-size: 12.5px; }
.report-cat-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.report-cat-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.report-cat-bar div { height: 100%; background: var(--accent); border-radius: 4px; }
.report-cat-sum { font-weight: 600; white-space: nowrap; }
.report-stress .stress-item { margin-bottom: 8px; }
.report-goal { margin-bottom: 10px; }
.report-goal-head { display: flex; justify-content: space-between; font-size: 13px; }
.report-changes { margin: 0; padding-left: 18px; font-size: 13.5px; }
.report-changes li { margin-bottom: 5px; }
.report-comment {
  min-height: 64px; border: 1px dashed var(--border-strong);
  border-radius: 8px; padding: 10px 12px; font-size: 13.5px;
}
.report-comment:empty::before { content: attr(data-placeholder); color: var(--text-soft); }
.report-foot { margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--border);
  color: var(--text-soft); font-size: 11.5px; }

@media print {
  .sidebar, .page-head, .tabs, .report-actions, .bell-panel,
  body.demo-on .page::before { display: none !important; }
  #shell { display: block; }
  .page { padding: 0; max-width: none; }
  .report { border: none; box-shadow: none; padding: 0; max-width: none; }
  body { background: #fff; }
}

/* Heatmap дисциплины тянется на всю карточку (клетки фикс 22px оставляли
   пустую правую половину на широких мониторах) */
.dash-hm-row {
  grid-template-columns: 160px repeat(var(--hm-days, 14), minmax(22px, 1fr));
}
.dash-hm-cell { width: auto; max-width: 44px; }

/* Адаптив узких окон */
@media (max-width: 1100px) {
  .health-grid { grid-template-columns: auto 1fr 1fr; }
  .stress-row { grid-template-columns: 1fr; }
  .extra-grid { grid-template-columns: 1fr; }
  .report-grid { grid-template-columns: 1fr; }
}
