/* public/funnel.css — «Воронка продаж» (З-1, 26.10.2026) */
.fn-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0 10px; }
.fn-toolbar select, .fn-toolbar input[type="search"], .fn-toolbar input[type="date"] { min-height: 36px; }
.fn-toolbar input[type="search"] { flex: 1 1 220px; min-width: 160px; }
.fn-switch { display: inline-flex; border: 1px solid var(--border, #d8dde6); border-radius: 8px; overflow: hidden; }
.fn-switch button { border: 0; border-radius: 0; padding: 6px 12px; background: transparent; }
.fn-switch button.active { background: var(--accent-soft, #e8f0fe); font-weight: 600; }
.fn-sum { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.fn-sum .fn-tile { border: 1px solid var(--border, #d8dde6); border-radius: 10px; padding: 6px 10px; min-width: 120px; cursor: pointer; background: var(--card, #fff); text-align: left; }
.fn-sum .fn-tile.active { outline: 2px solid var(--accent, #2563eb); }
.fn-tile b { display: block; font-size: 16px; }
.fn-tile small { color: var(--muted, #6b7280); }
.fn-tile.fn-red b { color: #b91c1c; }
.fn-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.fn-col { background: var(--bg-soft, #f4f6f9); border-radius: 10px; padding: 8px; min-height: 120px; }
.fn-col h4 { margin: 0 0 6px; font-size: 13px; display: flex; justify-content: space-between; gap: 6px; }
.fn-col h4 span { color: var(--muted, #6b7280); font-weight: 400; white-space: nowrap; }
.fn-card { background: var(--card, #fff); border: 1px solid var(--border, #d8dde6); border-radius: 8px; padding: 7px 9px; margin: 0 0 7px; cursor: pointer; font-size: 13px; }
.fn-card:hover { border-color: var(--accent, #2563eb); }
.fn-card .fn-top { display: flex; justify-content: space-between; gap: 6px; font-weight: 600; }
.fn-card .fn-client { overflow-wrap: anywhere; }
.fn-card .fn-meta { color: var(--muted, #6b7280); font-size: 12px; margin-top: 2px; }
.fn-bar { height: 5px; background: #e5e7eb; border-radius: 3px; margin: 5px 0 2px; overflow: hidden; }
.fn-bar i { display: block; height: 100%; background: #16a34a; }
.fn-step { margin-top: 4px; font-size: 12px; }
.fn-step.fn-late, .fn-nostep { color: #b91c1c; font-weight: 600; }
.fn-tag { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 9px; background: #eef2ff; color: #3730a3; margin-left: 4px; white-space: nowrap; }
.fn-table td, .fn-table th { font-size: 13px; vertical-align: top; }
.fn-table tr { cursor: pointer; }
.fn-lost { margin: 10px 0; }
.fn-lost table td { font-size: 13px; }
/* блок «Воронка» в окне заявки */
.fn-box { border: 1px solid var(--border, #d8dde6); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.fn-box h3 { margin: 0 0 6px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fn-box .fn-stage { font-size: 13px; padding: 2px 8px; border-radius: 9px; background: #e8f0fe; }
.fn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.fn-grid section { min-width: 0; }
.fn-grid h4 { margin: 4px 0; font-size: 13px; }
.fn-list { list-style: none; margin: 0; padding: 0; max-height: 220px; overflow: auto; font-size: 13px; }
.fn-list li { padding: 3px 0; border-bottom: 1px dashed var(--border, #e5e7eb); overflow-wrap: anywhere; }
.fn-kp-mark, .fn-ship-mark { margin: 6px 0; font-size: 13px; }
.fn-kp-dlg-wrap { position: fixed; inset: 0; z-index: 3000; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(15, 23, 42, .45); }
.fn-kp-dlg { width: 100%; max-width: 420px; max-height: calc(100vh - 32px); overflow: auto; box-sizing: border-box; padding: 16px; border-radius: 12px; background: var(--surface, #fff); color: var(--text, #1f2430); display: flex; flex-direction: column; gap: 10px; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
.fn-kp-dlg h3 { margin: 0; font-size: 16px; }
.fn-kp-dlg .fn-hint { margin: 0; }
.fn-kp-dlg label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.fn-kp-dlg input, .fn-kp-dlg select { width: 100%; box-sizing: border-box; min-height: 36px; margin: 0; }
.fn-kp-acts { display: flex; justify-content: flex-end; gap: 8px; }
.fn-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.fn-form input, .fn-form select { min-height: 32px; }
.fn-form input[type="text"] { flex: 1 1 160px; min-width: 120px; }
.fn-hint { color: var(--muted, #6b7280); font-size: 12px; }
html[data-theme="dark"] .fn-col { background: #1f2430; }
html[data-theme="dark"] .fn-tag { background: #312e81; color: #e0e7ff; }
html[data-theme="dark"] .fn-box .fn-stage { background: #1e3a8a; }
@media (max-width: 600px) {
  .fn-board { grid-auto-columns: 84vw; }
  .fn-sum .fn-tile { min-width: 46%; }
}
/* общие стили программы растягивают поля на всю ширину — здесь поля в строку */
#funnel-view { max-width: none; }
.fn-toolbar select, .fn-toolbar input[type="date"] { width: auto; max-width: 220px; margin: 0; }
.fn-toolbar input[type="search"] { width: auto; margin: 0; }
.fn-toolbar label { display: inline-flex; align-items: center; gap: 4px; margin: 0; }
.fn-box h3 select.fn-kind { width: auto; max-width: 220px; margin: 0; font-size: 13px; min-height: 30px; }
.fn-form input, .fn-form select { width: auto; margin: 0; }
.fn-form input[type="date"] { max-width: 150px; }
.fn-form input[type="time"] { max-width: 110px; }
@media (max-width: 600px) { .fn-toolbar select, .fn-toolbar input[type="date"] { max-width: 100%; flex: 1 1 45%; } }
/* З-2: отчёт «Воронка» и график оплат */
.fn-rep td, .fn-rep th { font-size: 13px; }
.fn-rep .fn-bar { margin: 4px 0; height: 8px; }
.fn-list li.fn-late { color: #b91c1c; }
/* 11-02g: свёрнутый график оплат */
.fn-plan-line { margin: 4px 0; font-size: 13px; overflow-wrap: anywhere; }
.fn-plan-line .fn-late { color: #b91c1c; font-weight: 600; }
html[data-theme="dark"] .fn-plan-line .fn-late { color: #f87171; }
.fn-plan .fn-form[hidden] { display: none; }
.fn-plan h4 .fn-plan-toggle { margin-left: 6px; }
#fn-report h4 { margin: 12px 0 6px; }
#fn-report .fn-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
#fn-report .table-scroll { overflow-x: auto; max-width: 100%; }
.fn-rep { width: 100%; }

/* 30.10.2026 (РОП, «РМ_2», п. 4): заметка менеджера в карточке и строке воронки */
.fn-note { margin-top: 4px; font-size: 12px; color: #475569; white-space: normal; overflow-wrap: anywhere; cursor: help; }
html[data-theme="dark"] .fn-note { color: #cbd5e1; }
/* Г2 (01.11.2026): перетаскивание карточек между стадиями (public/ui-g-drag.js, funnel.js → bindDrag) */
.fn-card.fn-drag { cursor: grab; touch-action: pan-y; }
.fn-col-lost { display: none; border: 2px dashed #d92d20; background: #fdecea; }
html.g-dragging .fn-col-lost { display: block; }
.fn-col-lost h4 { color: #b42318; }
.fn-col.g-drop-ok { outline: 2px solid var(--accent, #2563eb); outline-offset: -2px; }
.fn-col.g-drop-no { outline: 2px dashed #d92d20; outline-offset: -2px; }
.fn-col.g-drop-ok p.hint { display: none; }
html[data-theme="dark"] .fn-col-lost { background: #3a1513; border-color: #f97066; }
html[data-theme="dark"] .fn-col-lost h4 { color: #fda29b; }

/* 02.11.2026 (предложение №60): своя полоса доски была внизу высокой доски, за низом окна. Теперь под доской — полоса, закреплённая
   внизу окна (funnel.js → fitBoard, синхронна с доской). На телефоне доску листают пальцем — там без неё. */
.fn-hbar { position: sticky; bottom: 0; z-index: 3; height: 16px; overflow-x: auto; overflow-y: hidden; margin-top: 2px; background: var(--surface, #fff); }
.fn-hbar[hidden] { display: none; }
.fn-hbar > div { height: 1px; }
.fn-hbar::-webkit-scrollbar { height: 14px; }
.fn-hbar::-webkit-scrollbar-thumb { background: #8496A6; border-radius: 7px; border: 2px solid transparent; background-clip: padding-box; }
.fn-hbar::-webkit-scrollbar-track { background: #E2E8EE; border-radius: 7px; }
html[data-theme="dark"] .fn-hbar::-webkit-scrollbar-thumb { background: #5B7387; border: 2px solid transparent; background-clip: padding-box; }
html[data-theme="dark"] .fn-hbar::-webkit-scrollbar-track { background: #0C1B28; }
@media (min-width: 761px) { .fn-board { scrollbar-width: none; padding-bottom: 0; } .fn-board::-webkit-scrollbar { display: none; } }
/* 04.11.2026 (предложение №74): своя вертикальная прокрутка у каждой стадии; высоту считает funnel.js → fitCols. На телефоне — без неё, как раньше. */
@media (min-width: 761px) { .fn-col-list { max-height: var(--fn-col-max, none); overflow-y: auto; scrollbar-width: thin; } }
@media (max-width: 760px) { .fn-hbar { display: none; } }

/* 02.11.2026 (КИ-3): тёмная тема — цвета выше вписаны для светлой, генератор тёмной темы обрабатывает только style.css */
html[data-theme="dark"] .fn-switch button.active { background: #1F6699; color: #FFFFFF; }
html[data-theme="dark"] :is(.fn-step.fn-late, .fn-nostep, .fn-list li.fn-late, .fn-tile.fn-red b) { color: #F4867B; }
