/* Панель-1: светлая тема, без внешних шрифтов и библиотек */
/* Палитра этапов (stage.color): мягкие тинты гаммы панели, у каждого — тёмный текст той же семьи
   (контраст ≥ 4.5:1) и насыщенная линия для полос. Коды = CHECK в миграции 0005. */
:root {
  --st-blue-bg: #dbeafe;   --st-blue-fg: #1e40af;   --st-blue-line: #2563eb;
  --st-sky-bg: #e0f2fe;    --st-sky-fg: #075985;    --st-sky-line: #0284c7;
  --st-indigo-bg: #e0e7ff; --st-indigo-fg: #3730a3; --st-indigo-line: #4f46e5;
  --st-violet-bg: #ede9fe; --st-violet-fg: #5b21b6; --st-violet-line: #7c3aed;
  --st-green-bg: #dcfce7;  --st-green-fg: #166534;  --st-green-line: #16a34a;
  --st-mint-bg: #d1fae5;   --st-mint-fg: #065f46;   --st-mint-line: #059669;
  --st-amber-bg: #fef3c7;  --st-amber-fg: #92400e;  --st-amber-line: #d97706;
  --st-rose-bg: #fee2e2;   --st-rose-fg: #991b1b;   --st-rose-line: #dc2626;
  --st-gray-bg: #f1f3f5;   --st-gray-fg: #4b5563;   --st-gray-line: #9ca3af;
}
.st-blue   { --st-bg: var(--st-blue-bg);   --st-fg: var(--st-blue-fg);   --st-line: var(--st-blue-line); }
.st-sky    { --st-bg: var(--st-sky-bg);    --st-fg: var(--st-sky-fg);    --st-line: var(--st-sky-line); }
.st-indigo { --st-bg: var(--st-indigo-bg); --st-fg: var(--st-indigo-fg); --st-line: var(--st-indigo-line); }
.st-violet { --st-bg: var(--st-violet-bg); --st-fg: var(--st-violet-fg); --st-line: var(--st-violet-line); }
.st-green  { --st-bg: var(--st-green-bg);  --st-fg: var(--st-green-fg);  --st-line: var(--st-green-line); }
.st-mint   { --st-bg: var(--st-mint-bg);   --st-fg: var(--st-mint-fg);   --st-line: var(--st-mint-line); }
.st-amber  { --st-bg: var(--st-amber-bg);  --st-fg: var(--st-amber-fg);  --st-line: var(--st-amber-line); }
.st-rose   { --st-bg: var(--st-rose-bg);   --st-fg: var(--st-rose-fg);   --st-line: var(--st-rose-line); }
.st-gray   { --st-bg: var(--st-gray-bg);   --st-fg: var(--st-gray-fg);   --st-line: var(--st-gray-line); }
.pill[class*="st-"] { background: var(--st-bg); color: var(--st-fg); }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
       color: #1f2430; background: #f5f6f8; }
a { color: #1d4ed8; }
h1 { font-size: 24px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 12px; }
.muted { color: #6b7280; }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.inline { display: inline; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
[hidden] { display: none !important; }

/* шапка */
.top { display: flex; align-items: center; gap: 14px; padding: 10px 20px; background: #fff;
       border-bottom: 1px solid #e5e7eb; position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 800; font-size: 18px; color: #111827; text-decoration: none; }
/* меню разделов: «Сделки» / «Диалоги» + выпадающий список воронок (наведение; стрелка — клик/тап/клавиатура) */
.topnav { display: flex; gap: 4px; }
.dd { position: relative; display: flex; align-items: center; border-radius: 8px; }
.dd-link { color: #374151; text-decoration: none; padding: 6px 4px 6px 10px; border-radius: 8px 0 0 8px; }
.dd-toggle { font: inherit; font-size: 11px; border: 0; background: none; color: #6b7280; cursor: pointer;
             padding: 8px 8px 6px 4px; border-radius: 0 8px 8px 0; }
.dd:has(.dd-link.active) { background: #eef2ff; }
.dd-link.active, .dd:has(.dd-link.active) .dd-toggle { color: #1d4ed8; }
.dd-link:focus-visible, .dd-toggle:focus-visible, .dd-menu a:focus-visible { outline: 2px solid #60a5fa; outline-offset: 1px; }
.dd-menu { display: none; position: absolute; left: 0; top: 100%; z-index: 30; min-width: 280px; margin: 0; padding: 6px;
           list-style: none; background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
           box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.dd-menu::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 8px; } /* мост для мыши */
.dd.open .dd-menu { display: block; }
@media (hover: hover) { .dd:hover .dd-menu { display: block; } .dd:hover { background: #f3f4f6; }
                        .dd:has(.dd-link.active):hover { background: #e0e7ff; } }
.dd-cap { font-size: 11px; color: #6b7280; padding: 4px 10px 6px; text-transform: uppercase; letter-spacing: .3px; }
.dd-menu a { display: block; padding: 7px 10px; border-radius: 7px; color: #1f2430; text-decoration: none; white-space: nowrap; }
.dd-menu a:hover { background: #f3f4f6; }
.dd-menu a.cur { background: #eef2ff; color: #1d4ed8; font-weight: 600; }
.dd-menu a.cur::after { content: " ✓"; }
@media (max-width: 600px) {                       /* телефон: меню во всю ширину под шапкой, длинные названия переносятся */
  .top { flex-wrap: wrap; row-gap: 6px; }
  .dd { position: static; }
  .dd-menu { left: 8px; right: 8px; min-width: 0; }
  .dd-menu a { white-space: normal; }
}
.top-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

main { padding: 18px 20px 40px; }
.page { max-width: 1240px; margin: 0 auto; }

/* элементы */
.btn { display: inline-block; font: inherit; padding: 7px 14px; border: 1px solid #d1d5db; border-radius: 10px;
       background: #fff; color: #1f2430; cursor: pointer; text-decoration: none; line-height: 1.3; }
.btn:hover { border-color: #9ca3af; }
.btn-primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.btn-small { padding: 4px 10px; font-size: 13px; }
input, select, textarea { font: inherit; padding: 6px 9px; border: 1px solid #d1d5db; border-radius: 8px;
                          background: #fff; color: inherit; max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: #60a5fa; }
textarea { width: 100%; resize: vertical; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
        background: #eef2f7; color: #374151; white-space: nowrap; }
.pill-warn { background: #fef3c7; color: #92400e; }
.pill-bot { background: #dcfce7; color: #166534; }
.pill-user { background: #fef9c3; color: #854d0e; }
.alert { padding: 10px 14px; border-radius: 10px; margin: 12px 0; border: 1px solid transparent; }
.alert-err { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-ok { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }
.alert-warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert ul { margin: 4px 0 0; padding-left: 20px; }
.box { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 16px 18px; margin-bottom: 16px; }

/* вход */
.login-page main { display: flex; justify-content: center; padding-top: 10vh; }
.login-box { width: 360px; max-width: 100%; background: #fff; border: 1px solid #e5e7eb; border-radius: 16px; padding: 28px; }
.login-box h1 { margin-bottom: 8px; }
.login-box label { display: block; margin: 12px 0; font-weight: 600; font-size: 13px; }
.login-box input { display: block; width: 100%; margin-top: 4px; font-weight: 400; font-size: 15px; padding: 8px 10px; }
.login-box .btn { margin-top: 6px; }
#login-form .js-next, #login-form .js-back { display: none; }
#login-form.two-step .js-next, #login-form.two-step .js-back { display: inline-block; }
#login-form.two-step .step2 { display: none; }
#login-form.two-step.on-step2 .step1 { display: none; }
#login-form.two-step.on-step2 .step2 { display: block; }

/* доска */
.board-page main { padding-right: 0; }
.board-head { padding-right: 20px; }
.h-sub { font-size: 15px; font-weight: 400; margin-left: 8px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 14px 0 6px; }
.filters label { display: flex; flex-direction: column; font-size: 12px; color: #6b7280; gap: 3px; }
.board { display: flex; gap: 12px; overflow-x: auto; padding: 8px 20px 16px 0; align-items: flex-start; min-height: 60vh; }
.col { flex: 0 0 248px; background: #eceff3; border-radius: 12px; padding: 0 8px 8px; overflow: hidden; }
.col.over { background: #dbeafe; outline: 2px dashed #60a5fa; }
.col header { margin: 0 -8px 8px; padding: 9px 12px 8px; background: var(--st-bg); color: var(--st-fg);
              border-top: 4px solid var(--st-line); }
.col .col-note { color: var(--st-fg); opacity: .85; }
.col .card { border-left: 3px solid var(--st-line); }
.col-title { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; }
.count { background: rgba(255,255,255,.75); border-radius: 999px; padding: 0 8px; font-size: 12px; color: #374151; }
.col-note { font-size: 11px; color: #6b7280; margin-top: 2px; }
.cards { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.card { display: block; background: #fff; border-radius: 10px; padding: 9px 10px; text-decoration: none; color: inherit;
        border: 1px solid #e5e7eb; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.card:hover { border-color: #93c5fd; }
.card[draggable="true"] { cursor: grab; }
.card.dragging { opacity: .45; }
.card.pending { opacity: .6; }
.card-top { display: flex; justify-content: space-between; gap: 6px; font-weight: 600; }
.card-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code { font-size: 11px; color: #6b7280; font-weight: 400; white-space: nowrap; }
.card-line { font-size: 12.5px; margin-top: 3px; }
.owner { font-size: 12px; padding: 1px 7px; border-radius: 6px; }
.owner-bot { background: #dcfce7; color: #166534; }
.owner-user { background: #fef9c3; color: #854d0e; }
.more, .empty { font-size: 12px; color: #6b7280; text-align: center; padding: 6px; }
.flash { position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px; z-index: 20; max-width: min(720px, 92vw);
         padding: 12px 40px 12px 16px; border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.15); }
.flash.err { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }
.flash.ok { background: #f0fdf4; border: 1px solid #86efac; color: #166534; }
.flash-close { position: absolute; right: 8px; top: 6px; border: 0; background: none; font-size: 20px; cursor: pointer; color: inherit; }
.flash-link { margin-left: 6px; font-weight: 600; }

/* карточка сделки */
.crumbs { color: #6b7280; font-size: 13px; margin-bottom: 6px; }
.crumbs a { color: #6b7280; }
.deal-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.history { list-style: none; margin: 0; padding: 0; }
.ev { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 8px; padding: 6px 0; border-bottom: 1px solid #f1f3f5; }
.ev-at { color: #6b7280; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.ev-user .ev-text { color: #854d0e; }
.ev-rule .ev-text { color: #9a3412; }

/* диалоги (Панель-2) */
.h-link { font-size: 12px; font-weight: 400; margin-left: 8px; }
.dlg-head .filters { margin-top: 10px; }
.check-filter { flex-direction: row !important; align-items: center; gap: 6px !important; font-size: 13px !important;
                color: #374151 !important; padding-bottom: 6px; }
.dlg { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 16px; align-items: start; margin-top: 10px; }
@media (max-width: 900px) { .dlg { grid-template-columns: 1fr; } }
.dlg-list { padding: 8px; max-height: calc(100vh - 230px); overflow-y: auto; margin-bottom: 0; }
.dlg-item { display: flex; gap: 10px; padding: 10px; border-radius: 10px; text-decoration: none; color: inherit;
            border-bottom: 1px solid #f1f3f5; }
.dlg-item:hover { background: #f8fafc; }
.dlg-item.active { background: #eef4ff; box-shadow: inset 3px 0 0 #2563eb; }
.avatar { flex: 0 0 34px; height: 34px; border-radius: 50%; background: #ede9fe; color: #4c1d95; font-weight: 700;
          font-size: 13px; display: flex; align-items: center; justify-content: center; }
.dlg-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.dlg-row { display: flex; align-items: center; gap: 6px; }
.dlg-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-time { font-size: 12px; color: #6b7280; white-space: nowrap; }
.dlg-preview { font-size: 13px; color: #4b5563; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-body .pill { align-self: flex-start; }
.unread { background: #2563eb; color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 0 7px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #ef4444; flex: 0 0 8px; }
.dot-amber { background: #f59e0b; } .dot-green { background: #22c55e; }
.dlg-main { padding: 0; overflow: hidden; margin-bottom: 0; }
.dlg-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; padding: 12px 16px; }
.top-user { background: #fef9c3; } .top-bot { background: #dcfce7; }
.dlg-title { font-size: 16px; }
.feed-wrap { padding: 14px 16px; height: calc(100vh - 420px); min-height: 280px; overflow-y: auto; position: relative; }
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 72%; padding: 8px 12px; border-radius: 12px; background: #f1f5f9; }
.msg-out { align-self: flex-end; background: #dbeafe; }
.msg-user { background: #fef3c7; }
.msg.revealed { outline: 2px solid #fbbf24; }
.msg-head { font-size: 11.5px; font-weight: 700; color: #64748b; margin-bottom: 2px; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-reveal { margin-top: 2px; }
.msg-note { font-size: 11px; color: #92400e; margin-top: 2px; }
.linkbtn { border: 0; background: none; padding: 0; color: #1d4ed8; cursor: pointer; font: inherit; font-size: 12px; text-decoration: underline; }
.st { font-weight: 600; margin-left: 6px; padding: 0 6px; border-radius: 6px; }
.st-q { background: #e5e7eb; color: #374151; } .st-ok { background: #dcfce7; color: #166534; } .st-err { background: #fee2e2; color: #991b1b; }
.note { align-self: center; font-size: 12px; color: #6b7280; text-align: center; max-width: 90%; }
.note-at { font-variant-numeric: tabular-nums; }
#feed-paused { padding: 0 16px 6px; }
.reply { display: flex; gap: 10px; padding: 12px 16px 4px; border-top: 1px solid #e5e7eb; align-items: flex-end; }
.reply textarea { flex: 1; }
.reply-hint { padding: 0 16px 12px; margin: 0; }

/* карточка сделки как в amoCRM: данные — узкая колонка слева (своя прокрутка), переписка — справа на всю высоту */
.deal-page { height: 100vh; display: flex; flex-direction: column; }
.deal-page main { flex: 1; min-height: 0; padding: 0; }
.deal-layout { display: grid; height: 100%; grid-template-columns: 400px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr);
               grid-template-areas: "head chat" "side chat"; }
.deal-headbox { grid-area: head; background: #fff; border-right: 1px solid #e5e7eb; border-bottom: 1px solid #e5e7eb;
                padding: 12px 16px 10px; }
.deal-headbox h1 { font-size: 20px; margin: 2px 0 6px; overflow-wrap: anywhere; }
.deal-headbox .deal-head { margin-bottom: 6px; }
.deal-headbox .alert { margin: 8px 0 0; }
.deal-side { grid-area: side; min-height: 0; display: flex; flex-direction: column; background: #fff;
             border-right: 1px solid #e5e7eb; }
.side-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.side-scroll > .alert { margin: 10px 16px 0; font-size: 13px; }
.side-sec { padding: 12px 16px; border-bottom: 1px solid #eef0f3; }
.side-sec h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .3px; color: #4b5563; margin: 0 0 8px; }
.deal-chat { grid-area: chat; display: flex; flex-direction: column; min-height: 0; background: #fff; }
.tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; padding: 0 16px; border-bottom: 1px solid #e5e7eb; }
.tab { font: inherit; font-weight: 600; border: 0; background: none; padding: 11px 10px 9px; cursor: pointer; color: #6b7280;
       border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab.active { color: #1d4ed8; border-bottom-color: #2563eb; }
.tabs .h-link { margin-left: auto; }
.pad { padding: 14px 16px; }
.deal-chat .tab-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.deal-chat #tab-history { overflow-y: auto; }
.js-tabs .tab-pane:not(.active) { display: none; }
.js-tabs .tab-h { display: none; }
.feed-deal { flex: 1; height: auto; min-height: 200px; background: #f8fafc; }
/* этап в карточке: шапка цветом этапа + список всех этапов воронки (как в amoCRM, в гамме панели) */
.stage-pick { position: relative; margin: 2px 0 6px; }
.stage-btn { display: flex; flex-direction: column; align-items: stretch; width: 100%; text-align: left; font: inherit;
             border: 0; border-radius: 10px; padding: 7px 12px 8px; cursor: pointer; background: var(--st-bg);
             color: var(--st-fg); box-shadow: inset 4px 0 0 var(--st-line); }
.stage-btn.is-static { cursor: default; }
.stage-btn:hover:not(.is-static) { filter: brightness(.97); }
.stage-btn:focus-visible { outline: 2px solid #60a5fa; outline-offset: 2px; }
.stage-pipe { font-size: 11.5px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-cur { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; font-size: 15px; }
.stage-cur .caret { font-size: 12px; transition: transform .15s; }
.stage-pick.open .caret { transform: rotate(180deg); }
.stage-menu { margin-top: 6px; padding: 6px; background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; }
.stage-pick.js .stage-menu { display: none; position: absolute; left: 0; right: 0; top: calc(100% - 2px); z-index: 40;
                             max-height: min(70vh, 520px); overflow-y: auto; box-shadow: 0 10px 28px rgba(15,23,42,.16); }
.stage-pick.js.open .stage-menu { display: block; }
.stage-menu-cap { font-size: 11px; color: #6b7280; text-transform: uppercase; letter-spacing: .3px; padding: 2px 6px 6px; }
.stage-opt { display: flex; align-items: center; gap: 6px; width: 100%; margin: 0 0 3px; padding: 6px 10px 6px 6px;
             border: 0; border-radius: 7px; font: inherit; font-size: 13.5px; text-align: left; cursor: pointer;
             background: var(--st-bg); color: var(--st-fg); }
.stage-opt:hover, .stage-opt:focus-visible { box-shadow: inset 0 0 0 2px var(--st-line); outline: none; }
.stage-opt .chk { flex: 0 0 16px; text-align: center; font-weight: 700; }
.stage-opt .nm { flex: 1; min-width: 0; }
.stage-opt.cur { font-weight: 700; box-shadow: inset 4px 0 0 var(--st-line); }
.stage-opt.off { opacity: .5; cursor: not-allowed; }
.stage-opt.off:hover { box-shadow: none; }
.stage-opt .why { font-size: 11px; white-space: nowrap; }
.stage-reason { font-size: 13px; color: #4b5563; margin: -2px 0 6px; }
.mono-line { margin-top: 2px; }
/* диалог причины отказа */
.lost-dlg { border: 1px solid #e5e7eb; border-radius: 14px; padding: 18px 20px; width: min(440px, 94vw);
            box-shadow: 0 20px 50px rgba(15,23,42,.25); color: #1f2430; }
.lost-dlg::backdrop { background: rgba(15,23,42,.35); }
.lost-dlg h3 { margin: 0 0 12px; font-size: 16px; }
.lost-dlg .reasons { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.dlg-comment { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #4b5563; }
.dlg-comment textarea { font-size: 13px; }
.dlg-comment.need { color: #991b1b; }
.dlg-actions { margin-top: 14px; justify-content: flex-end; }

/* поля сделки, контакт, ответственный — единый вид (как в amoCRM): серое название слева — значение
   справа простым текстом, без рамок; правка — по клику прямо в строке */
.fields { display: block; }
.frow { display: grid; grid-template-columns: 168px minmax(0, 1fr); column-gap: 10px; align-items: center;
        min-height: 30px; font-size: 13px; position: relative; }
.fname { color: #6b7280; line-height: 1.35; padding: 4px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.req { color: #b91c1c; font-weight: 700; font-size: 11px; margin-left: 3px; cursor: help; vertical-align: super; line-height: 0; }
.fval { min-width: 0; }
.fval .ro, .fshow { display: block; width: calc(100% + 6px); padding: 4px 6px; margin: 0 0 0 -6px; border-radius: 6px; color: #1f2430;
                    text-align: left;
                    overflow-wrap: anywhere; line-height: 1.35; }
.fval .ro.empty, .fshow.empty { color: #9ca3af; }
.fval .ro.masked { letter-spacing: .5px; }
.fval .ro.revealed { font-weight: 600; background: #fffbeb; }
.fshow { font: inherit; text-align: left; border: 0; background: none; cursor: pointer; }
.fshow:hover, .fshow:focus-visible { background: #f1f5f9; outline: none; }
.fshow.list::after { content: " ▾"; color: #9ca3af; font-size: 11px; }
.fshow.empty.list { color: #2563eb; }
.frow.dirty .fshow { color: #1d4ed8; background: #eff6ff; }
.frow.dirty::before { content: ""; position: absolute; left: -10px; top: 6px; bottom: 6px; width: 3px; border-radius: 2px; background: #2563eb; }
.frow.missing .fname { color: #991b1b; font-weight: 600; }
.frow.missing .fshow { background: #fef2f2; }
.fin { width: calc(100% + 6px); min-width: 0; margin-left: -6px; padding: 3px 6px; font-size: 13px; border-radius: 6px; }
textarea.fin { resize: vertical; }
.frow:not(.fe) .fin { border-color: transparent; background: transparent; }       /* «Причина» у ответственного */
.frow:not(.fe) .fin:hover { background: #f1f5f9; }
.frow:not(.fe) .fin:focus { background: #fff; border-color: #60a5fa; }
.fpop { display: flex; flex-direction: column; gap: 1px; }
.opt { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; cursor: pointer; }
.opt:hover { background: #f1f5f9; }
.opt:has(input:checked) { background: #eff6ff; color: #1d4ed8; font-weight: 600; }
.opt-none { color: #6b7280; }
.pop-done { align-self: flex-end; margin-top: 4px; }
/* с JS: значение — текст; правка — поле на месте строки, списки — всплывающий список под строкой */
.js-fields .frow.fe .fedit { display: none; }
.js-fields .frow.fe.editing .fedit { display: block; }
.js-fields .frow.fe.editing:not([data-type=enum]):not([data-type=bool]):not([data-type=multienum]) .fshow { display: none; }
.js-fields .fpop { position: absolute; z-index: 30; left: 172px; right: 0; top: 100%; max-height: 300px; overflow-y: auto;
                   padding: 5px; background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
                   box-shadow: 0 10px 28px rgba(15,23,42,.16); }
.js-fields .fpop .opt input { position: absolute; opacity: 0; pointer-events: none; }
.js-fields .fpop .opt::before { content: ""; flex: 0 0 14px; font-weight: 700; text-align: center; }
.js-fields .fpop .opt:has(input:checked)::before { content: "✓"; }
.fshow { display: none; }
.js-fields .fshow { display: block; }
.side-note { margin: 6px 0 0; }
.own-actions { margin: 6px 0 2px; }
/* закреплённые «Сохранить» / «Отмена» внизу левой колонки — только при изменениях */
.save-bar { flex: none; display: flex; gap: 8px; align-items: center; padding: 10px 16px; background: #fff;
            border-top: 1px solid #e5e7eb; box-shadow: 0 -4px 12px rgba(15,23,42,.06); }
.save-bar .save-hint { margin-left: auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deal-side.js-on .save-bar:not(.show) { display: none; }
.save-bar .js-cancel { display: none; }
.deal-side.js-on .save-bar .js-cancel { display: inline-block; }
@media (max-width: 900px) {
  .deal-page { height: auto; display: block; }
  .deal-layout { display: block; height: auto; }
  .deal-headbox, .deal-side { border-right: 0; }
  .deal-side, .side-scroll { overflow: visible; display: block; }
  .save-bar { position: sticky; bottom: 0; z-index: 10; }
  .deal-chat { border-bottom: 1px solid #e5e7eb; }
  .feed-deal { flex: none; height: 60vh; min-height: 260px; }
  .tabs .h-link { margin-left: 0; padding-bottom: 8px; }
}
