/* Шапка «Сделки», аналитика, профиль, распределение */

/* ===== шапка: Сделки / вид / воронка / поиск ===== */
.topbar { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.brand .mark { width: 38px; height: 38px; font-size: 12px; }
.section { display: flex; flex-direction: column; gap: 6px; }
.section-title { font-size: 20px; font-weight: 700; letter-spacing: -.01em; padding-left: 4px; }
.section .segs { margin: 0; }
.pipe { display: flex; flex-direction: column; gap: 4px; align-self: flex-end; }
.pipe-label { font-size: 11px; color: var(--muted); font-weight: 600; padding-left: 12px; }
.pipe select { font-size: 13px; font-weight: 600; border: none; background: #fff; border-radius: 18px; padding: 9px 14px; cursor: pointer; min-width: 170px; }
.search { position: relative; flex: 1 1 320px; max-width: 560px; align-self: flex-end; display: flex; align-items: center; background: #fff; border-radius: 22px; padding: 4px 4px 4px 14px; gap: 8px; }
.search:focus-within { box-shadow: 0 0 0 2px var(--accent-ring); }
.search-ic { color: var(--faint); flex: none; }
.search input#searchQ { flex: 1; border: none; outline: none; font-size: 14px; padding: 6px 0; min-width: 0; background: transparent; }
.filter-btn { display: inline-flex; align-items: center; gap: 6px; border: none; background: var(--soft); border-radius: 18px; padding: 7px 12px; cursor: pointer; font-size: 13px; color: var(--text); white-space: nowrap; }
.filter-btn:hover { background: #e6ebf0; }
.badge-n { background: var(--accent); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 11px; font-weight: 700; }
.filter-pop { position: absolute; top: calc(100% + 8px); left: 0; right: 0; min-width: 340px; background: #fff; border-radius: 18px; box-shadow: 0 12px 40px rgba(20,30,50,.18); padding: 16px 18px; z-index: 40; }
.fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 14px; }
.fgrid .f { margin-top: 6px; display: block; }
.mini-segs { display: flex; gap: 12px; font-size: 13px; margin-bottom: 6px; }
.mini-segs label { display: flex; align-items: center; gap: 5px; cursor: pointer; }
.dates { display: flex; align-items: center; gap: 6px; }
.dates .input { padding: 8px 10px; }
.dash { color: var(--faint); }
.fbtns { display: flex; justify-content: flex-end; align-items: center; gap: 16px; margin-top: 14px; }
.me { margin-left: auto; align-self: center; }
.icon-link { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: #3d4350; font-size: 13px; padding: 8px 12px; border-radius: 18px; }
.icon-link:hover, .icon-link.on { background: #fff; color: var(--text); }
.icon-link.on { font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.btn.sm { min-height: 36px; padding: 7px 14px; font-size: 13px; }
.kcard .owner { font-size: 11px; color: var(--muted); }
.kcard.waiting { opacity: .85; }
.age { font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.age.late { color: var(--late); }

/* ===== аналитика ===== */
.an { display: flex; flex-direction: column; gap: 14px; }
.an-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.an-bar h1 { font-size: 20px; margin: 0 10px 0 4px; }
.chips { display: flex; background: #dde3ea; border-radius: 20px; padding: 3px; flex-wrap: wrap; }
.chips a, .chips button { font-size: 13px; text-decoration: none; color: #3d4350; padding: 7px 14px; border-radius: 16px; border: none; background: none; cursor: pointer; }
.chips .on { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.custom-period { display: flex; align-items: center; gap: 6px; }
.custom-period .input { padding: 7px 10px; background: #fff; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-height: 132px; }
.kpi .k { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi .v { font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: 15px; font-weight: 600; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.kpi .sub { font-size: 12px; color: var(--muted); }
.delta { font-size: 12px; font-weight: 600; margin-top: auto; }
.delta.good { color: #1c7a3c; }
.delta.bad { color: var(--late); }
.delta.neutral { color: var(--muted); }
.now-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.now { padding: 12px 16px; display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.now:hover { color: inherit; box-shadow: 0 2px 8px rgba(20,30,50,.08); }
.now .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.now b { font-size: 22px; font-variant-numeric: tabular-nums; }
.now span { color: var(--muted); font-size: 13px; }
.an-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.an-card { padding: 16px 18px; min-width: 0; }
.an-card h2 { font-size: 15px; margin: 0 0 2px; }
.an-card .hint2 { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.span12 { grid-column: span 12; }
.span8 { grid-column: span 8; }
.span7 { grid-column: span 7; }
.span6 { grid-column: span 6; }
.span5 { grid-column: span 5; }
.span4 { grid-column: span 4; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend i.line { height: 2px; border-radius: 1px; vertical-align: 3px; width: 14px; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: Onest, Arial, sans-serif; }
.tip { position: absolute; pointer-events: none; background: #1f2430; color: #fff; font-size: 12px; line-height: 1.45; padding: 7px 10px; border-radius: 9px; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); opacity: 0; transition: opacity .1s; z-index: 5; }
.tip.on { opacity: 1; }
.hbars { display: flex; flex-direction: column; gap: 7px; }
.hbar { display: grid; grid-template-columns: minmax(0, 42%) minmax(0, 1fr) 70px; gap: 10px; align-items: center; font-size: 13px; }
.hbar .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { height: 10px; background: #f0f3f6; border-radius: 5px; overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 0 5px 5px 0; background: #2a78d6; }
.hbar .num { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.hbar .num small { color: var(--muted); font-weight: 400; margin-left: 4px; }
.heat { display: grid; grid-template-columns: 28px repeat(24, minmax(0, 1fr)); gap: 2px; font-size: 10px; color: var(--muted); }
.heat .c { aspect-ratio: 1.5; border-radius: 3px; background: #f0f3f6; }
.heat .h { text-align: center; }
.heat-scale { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); margin-top: 10px; }
.heat-scale i { width: 18px; height: 10px; border-radius: 2px; display: inline-block; }
.staff td, .staff th { padding: 8px 10px; }
.staff .bar { height: 6px; border-radius: 0 3px 3px 0; background: #2a78d6; margin-top: 4px; }
.num { font-variant-numeric: tabular-nums; }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut-legend { display: flex; flex-direction: column; gap: 7px; font-size: 13px; }
.donut-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; }
.donut-legend b { margin-left: 6px; font-variant-numeric: tabular-nums; }
.empty-chart { color: var(--muted); font-size: 13px; padding: 30px 0; text-align: center; }

/* ===== профиль ===== */
.prof { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 14px; align-items: start; }
.prof-card { padding: 22px; display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.prof-card .big-av { width: 72px; height: 72px; border-radius: 50%; background: var(--accent-ring); color: var(--accent-dark); display: grid; place-items: center; font-size: 26px; font-weight: 700; margin-bottom: 8px; }
.prof-card h1 { font-size: 20px; margin: 0 0 8px; }

/* ===== распределение ===== */
.dist { padding: 18px 20px; }
.dist h2 { margin: 0; font-size: 16px; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-top: 12px; }
.person { display: flex; align-items: center; gap: 10px; background: var(--soft); border-radius: 14px; padding: 10px 12px; cursor: pointer; font-size: 13px; }
.person input, .switch input { width: 18px; height: 18px; accent-color: var(--accent); }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; font-weight: 600; }

@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .span8, .span7, .span6, .span5, .span4 { grid-column: span 12; }
}
@media (max-width: 760px) {
  .kpis, .now-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prof { grid-template-columns: 1fr; }
  .fgrid { grid-template-columns: 1fr; }
  .search { order: 5; max-width: none; flex-basis: 100%; }
  .section { width: 100%; }
  .me { margin-left: 0; }
}
.chat-head select.auto { background: #fff3d6; }
.chat-head input#fObject { font-size: 12px; border: none; background: var(--soft); border-radius: 14px; padding: 7px 10px; width: 150px; }
.hbar .track, .hbar .fill { display: block; }

/* карточка канбана: ФИО, метки, ответственный с фото, время */
.kcard { position: relative; gap: 7px; padding: 11px 12px; }
.kcard.urgent { padding-left: 15px; }
.kcard.urgent::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: #b3261e; }
.k-row { display: flex; align-items: center; gap: 8px; }
.k-row .nm { flex: 1; min-width: 0; font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k-cnt { background: var(--accent); color: #fff; border-radius: 10px; min-width: 20px; height: 20px; padding: 0 6px; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; flex: none; }
.k-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.k-tag { font-size: 11px; font-weight: 700; border-radius: 8px; padding: 2px 7px; white-space: nowrap; }
.k-tag.new { background: #e6edff; color: #1d4ed8; }
.k-tag.rep { background: #fff3d6; color: #8a5a00; }
.k-tag.hot { background: #fde8e8; color: #b3261e; }
.k-tag.topic { background: var(--soft); color: var(--text); font-weight: 600; }
.k-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding-top: 7px; font-size: 12px; color: var(--muted); }
.k-who { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.k-who > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k-ph { width: 22px; height: 22px; border-radius: 50%; flex: none; object-fit: cover; background: var(--accent-ring); color: var(--accent-dark); font-size: 9px; font-weight: 700; display: inline-grid; place-items: center; }
.k-right { display: inline-flex; align-items: center; gap: 8px; flex: none; }
.k-eye { font-size: 11px; color: var(--muted); }
.kcard .age { font-size: 12px; } .kcard .age.late { color: #b3261e; font-weight: 700; }
img.av { object-fit: cover; }
img.big-av { object-fit: cover; display: block; }
.photo-form { display: flex; gap: 6px; margin: 4px 0 10px; }

/* карточка «спокойная»: без плашек, только текст и одна цветная точка; красное — только то, что горит */
.kcard.calm { gap: 0; padding: 10px 12px; }
.kcard.calm .k-row .nm { font-weight: 600; }
.k-new { color: var(--accent); font-weight: 700; font-size: 12px; flex: none; }
.k-sub { font-size: 12px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k-dot { font-size: 10px; vertical-align: 1px; }
.k-dot.new { color: #1d4ed8; } .k-dot.rep { color: #d99a00; } .k-dot.hot { color: #b3261e; }
.kcard.calm .k-foot { border-top: none; padding-top: 0; margin-top: 7px; font-size: 12px; }
.kcard.calm .k-ph { width: 18px; height: 18px; font-size: 8px; }
.kcard.calm .k-eye { color: var(--muted); }

/* «не прочитано» на карточке канбана — спокойно, без красной плашки */
.kcard .new { background: none; color: var(--accent); padding: 0; font-weight: 600; }
.kcard .owner { display: inline-flex; align-items: center; gap: 6px; }
.kcard .owner .k-ph { width: 18px; height: 18px; }

/* канбан: время всегда серое; «не прочитано» — мягкая голубая плашка */
.kcard .age, .kcard .age.late { color: var(--muted); font-weight: 600; }
.kcard .new { background: #eef3ff; color: #5b74c9; padding: 1px 8px; border-radius: 10px; font-weight: 600; }
