/* ЦУП — по дизайн-системе Afifa Harness («поле и листы»): тёплое поле, белые листы, монохром.
   Токены — из её tokens.json; цветные — только статусы (success / warning / danger), всегда со словом. */
@import url('https://fonts.googleapis.com/css2?family=Onest:wght@400;500;600&display=swap');

:root {
  --canvas: #ebe8e3; --canvas-hover: #e1ddd6; --canvas-line: #d6d1c8;
  --surface: #ffffff; --surface-subtle: #f8f7f5; --surface-sunken: #efede9;
  --border: #e4e0d9; --border-control: #8a857c;
  --ink: #1b1b1a; --ink-muted: #5f5c56; --primary: #1b1b1a; --on-primary: #ffffff;
  --accent: #45423d; --on-accent: #ffffff; --mark-bg: #d9d4cc; --accent-soft: #f6f1e4; --accent-border: #e6dcc2;
  --bubble-out: #e6e1d8;
  --success: #1d7340; --success-soft: #e2f3e8; --warning: #8a5300; --warning-soft: #fcefd6;
  --danger: #bf2f28; --danger-soft: #fde6e4; --danger-border: #efc4bf;
  --radius-sm: 4px; --radius-md: 6px; --radius-lg: 12px; --radius-xl: 10px; --radius-pill: 999px;
  --shadow-panel: 0 1px 2px rgba(27,27,26,0.05);
  --shadow-raised: 0 1px 2px rgba(27,27,26,0.06), 0 2px 8px rgba(27,27,26,0.06);
  --font-sans: "Onest", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  /* прежние имена — для старых страниц */
  --bg: var(--canvas); --panel: var(--surface); --text: var(--ink); --muted: var(--ink-muted); --line: var(--border);
  --warn: var(--warning); --bad: var(--danger); --ok: var(--success); --radius: var(--radius-xl);
  --in: var(--bubble-out); --out: var(--surface-subtle); --note: var(--accent-soft);
}
@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #161514; --canvas-hover: #211f1d; --canvas-line: #2c2a27;
    --surface: #292725; --surface-subtle: #2f2d2a; --surface-sunken: #33312e;
    --border: #363330; --border-control: #7a756d;
    --ink: #f1f0ec; --ink-muted: #aaa69e; --primary: #f1f0ec; --on-primary: #1b1b1a;
    --accent: #d3cfc7; --on-accent: #1b1b1a; --mark-bg: #33312d; --accent-soft: #2a261c; --accent-border: #3d3726;
    --bubble-out: #3a3733;
    --success: #62cf8d; --success-soft: #163021; --warning: #f0b357; --warning-soft: #352710;
    --danger: #ff8d84; --danger-soft: #3a1a18; --danger-border: #5a2c27;
    --shadow-panel: 0 1px 2px rgba(0,0,0,0.4); --shadow-raised: 0 1px 2px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.35);
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink);
       font: 15px/22px var(--font-sans); -webkit-font-smoothing: antialiased; }
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--border-control); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
h1 { font-size: 28px; line-height: 34px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 16px;
     display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h2 { font-size: 17px; line-height: 24px; font-weight: 600; margin: 24px 0 10px; }
h3 { font-size: 15px; line-height: 22px; font-weight: 600; margin: 16px 0 8px; }
code { font: 13px/18px var(--font-mono); background: var(--surface-sunken); padding: 1px 5px; border-radius: var(--radius-sm); }
.muted { color: var(--ink-muted); font-weight: normal; }
.small { font-size: 13px; line-height: 18px; }
.bad { color: var(--danger); }
.ok { color: var(--success); }
.ico { width: 16px; height: 16px; flex: none; display: inline-block; vertical-align: -3px; }

/* верхняя полоса */
.top { display: flex; align-items: center; gap: 16px; padding: 12px 24px; flex-wrap: wrap; background: var(--canvas); }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; color: var(--ink);
        text-decoration: none; letter-spacing: -0.01em; }
.mark { width: 28px; height: 28px; border-radius: var(--radius-md); background: var(--mark-bg); color: var(--accent);
        display: inline-flex; align-items: center; justify-content: center; }
.mark svg { width: 18px; height: 18px; }
.top nav { display: flex; gap: 2px; flex-wrap: wrap; }
.top nav a { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--radius-pill);
             color: var(--ink-muted); font-size: 14px; font-weight: 500; text-decoration: none; }
.top nav a:hover { background: var(--canvas-hover); color: var(--ink); }
.top nav a.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-raised); }
.top .search { margin-left: auto; width: 240px; max-width: 100%; }
.top .search input { height: 32px; background: var(--surface); }
.me { font-size: 13px; color: var(--ink-muted); white-space: nowrap; }
.me a { color: var(--ink-muted); }
.me a.on { font-weight: 600; color: var(--ink); }
main { max-width: 1320px; margin: 0 auto; padding: 8px 24px 48px; }
main.wide { max-width: 1680px; }

.head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.head h1 { margin-bottom: 8px; }
.flash { background: var(--accent-soft); border: 1px solid var(--accent-border); padding: 10px 14px; border-radius: var(--radius-lg); margin-bottom: 16px; }
.notice { background: var(--surface); border: 1px solid var(--border); padding: 10px 14px; border-radius: var(--radius-lg); }
.notice.bad { color: var(--danger); border-color: var(--danger-border); }
.desc { white-space: pre-wrap; color: var(--ink-muted); margin-top: 0; }

/* кнопки: чёрная пилюля — главное действие, белая с рамкой — второстепенное */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 16px;
       background: var(--primary); color: var(--on-primary); border: 1px solid var(--primary); border-radius: var(--radius-pill);
       font: 500 14px/20px var(--font-sans); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { text-decoration: none; filter: brightness(1.15); }
.btn.ghost, .btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--border-control); }
.btn.ghost:hover, .btn.secondary:hover { background: var(--surface-subtle); filter: none; }
.btn.plain { background: transparent; color: var(--ink); border-color: transparent; }
.btn.plain:hover { background: var(--canvas-hover); filter: none; }
.btn.sm { height: 28px; padding: 0 12px; font-size: 13px; }
.btn .ico { width: 16px; height: 16px; }
button.link { background: none; border: 0; color: var(--ink-muted); padding: 0; font: inherit; font-size: 13px; cursor: pointer;
              text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
button.link:hover { color: var(--danger); }
form.inline { display: inline; }

/* метки */
.pill, .badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--radius-sm);
                font-size: 12px; line-height: 16px; font-weight: 500; background: var(--surface-sunken); color: var(--ink); white-space: nowrap; }
.pill.warn, .badge.warn { background: var(--warning-soft); color: var(--warning); }
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.accent { background: var(--accent-soft); color: var(--ink); }
.top nav .pill { height: 18px; padding: 0 6px; border-radius: var(--radius-pill); }
.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; font-size: 12px; border-radius: var(--radius-sm);
        border: 1px solid var(--border); margin-right: 4px; color: var(--ink); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips a, .chips button { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: var(--radius-pill);
                          border: 1px solid var(--border); background: var(--surface); color: var(--ink-muted); font: 500 13px/18px var(--font-sans);
                          text-decoration: none; cursor: pointer; }
.chips a:hover, .chips button:hover { color: var(--ink); border-color: var(--border-control); }
.chips a.on, .chips button.on { color: var(--ink); border-color: var(--ink); }
.seg { display: inline-flex; padding: 2px; gap: 2px; border-radius: var(--radius-md); background: var(--surface-sunken); flex-wrap: wrap; }
.seg a, .seg label { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 5px;
                     font-size: 13px; color: var(--ink-muted); text-decoration: none; cursor: pointer; }
.seg a:hover, .seg label:hover { color: var(--ink); }
.seg a.on, .seg label:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-panel); font-weight: 500; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }

/* статус клиента и этап проекта — монохром + слово */
.stage { display: inline-flex; align-items: center; height: 22px; font-size: 12px; font-weight: 500; padding: 0 8px; border-radius: var(--radius-sm);
         background: var(--surface-sunken); color: var(--ink); white-space: nowrap; }
.st-active { background: var(--success-soft); color: var(--success); }
.st-prospect { background: var(--accent-soft); color: var(--ink); }
.st-former, .st-new { background: var(--surface-sunken); color: var(--ink-muted); }
.stages { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 8px; }
.stages button.stage { cursor: pointer; font: inherit; font-size: 13px; opacity: .6; border: 1px solid transparent; }
.stages button.stage.cur { opacity: 1; border-color: var(--ink); }
.stages button.stage:hover { opacity: 1; }

/* плитки воронки на сводке */
.funnel { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-panel);
        padding: 12px 14px; color: var(--ink); display: flex; flex-direction: column; text-decoration: none; }
.tile:hover { border-color: var(--border-control); }
.tile .n { font-size: 24px; line-height: 30px; font-weight: 600; }
.tile .l { color: var(--ink-muted); font-size: 13px; line-height: 18px; }
.tile .m { font-size: 13px; line-height: 18px; margin-top: 2px; }
.tile.after { border-top: 2px solid var(--border-control); }

.cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 24px; }
@media (max-width: 860px) { .cols { grid-template-columns: 1fr; } main { padding: 8px 16px 32px; } .top { padding: 10px 16px; gap: 10px; }
  .top .search { margin-left: 0; width: 100%; order: 5; } }

.row { display: flex; justify-content: space-between; gap: 12px; background: var(--surface); border: 1px solid var(--border);
       border-radius: var(--radius-lg); padding: 10px 14px; margin-bottom: 8px; color: var(--ink); text-decoration: none; }
.row:hover { border-color: var(--border-control); }
.row.late { box-shadow: inset 3px 0 0 var(--warning); }
.row .main { min-width: 0; overflow-wrap: anywhere; }
.when { color: var(--ink-muted); font-size: 12px; white-space: nowrap; }
.feed { padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 14px; line-height: 20px; overflow-wrap: anywhere; }
.feed .when { margin-right: 6px; }

.tabs { display: flex; gap: 2px; flex-wrap: wrap; margin: 8px 0 12px; }
.tabs a { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: var(--radius-pill); color: var(--ink-muted);
          font-size: 14px; font-weight: 500; text-decoration: none; }
.tabs a:hover { background: var(--canvas-hover); color: var(--ink); }
.tabs a.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-raised); }
.scroll-x { overflow-x: auto; }
table.list { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--border);
             border-radius: var(--radius-xl); overflow: hidden; box-shadow: var(--shadow-panel); }
table.list th, table.list td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.list th { font-size: 12px; color: var(--ink-muted); font-weight: 500; }
table.list tr:last-child td { border-bottom: 0; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 10px 14px; margin-bottom: 8px; }
.card form { margin-top: 4px; }
.card.wide .head { margin-bottom: 6px; }
.linkbar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.linkbar form { display: flex; gap: 8px; margin: 0; flex-wrap: wrap; }

.msg { border-radius: var(--radius-lg); padding: 8px 12px; margin-bottom: 8px; border: 1px solid var(--border); }
.msg.in { background: var(--bubble-out); border-color: transparent; margin-right: 48px; }
.msg.out { background: var(--surface-subtle); margin-left: 48px; }
.msg.note { background: var(--accent-soft); border-color: var(--accent-border); }
.msg.failed { border-color: var(--danger); }
.msg .meta { font-size: 13px; display: flex; gap: 6px; flex-wrap: wrap; align-items: baseline; }
.msg .meta .when { margin-left: auto; }
.msg .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .err { color: var(--danger); font-size: 13px; }
.files { display: block; font-size: 13px; color: var(--ink-muted); }
.ev { font-size: 13px; color: var(--ink-muted); padding: 4px 12px; margin-bottom: 8px; }
.ev .when { margin-right: 6px; }

/* формы */
.form { display: flex; flex-direction: column; gap: 12px; max-width: 560px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-muted); }
.form.small { gap: 8px; margin-top: 8px; }
input, textarea, select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border-control);
                          border-radius: var(--radius-md); padding: 7px 10px; width: 100%; min-height: 36px; }
textarea { line-height: 22px; }
input::placeholder, textarea::placeholder { color: var(--ink-muted); }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--ink); outline-offset: 0; border-color: var(--ink); }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--ink); }
.linkbar select { width: auto; min-width: 200px; }
details { margin-bottom: 8px; }
summary { cursor: pointer; color: var(--ink); font-size: 14px; font-weight: 500; }
summary:hover { text-decoration: underline; text-decoration-color: var(--border-control); text-underline-offset: 3px; }
.form label.chk { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
.form label.chk input { width: auto; }

/* вход */
main.login { max-width: 420px; margin-top: 12vh; }
main.login .card { padding: 24px; }
main.login .btn { margin: 8px 0 12px; }

/* журнал и задачи (старые разметки) */
.inrow { display: flex; gap: 8px; }
.inrow > * { flex: 1; min-width: 0; }
.inrow input[type=date], .inrow select { flex: 0 0 auto; width: auto; }
details.add > summary { font-weight: 600; }
.note-card { background: var(--surface-subtle); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 10px 14px; margin-bottom: 8px; }
.note-card .meta { font-size: 13px; display: flex; gap: 6px; flex-wrap: wrap; align-items: baseline; }
.note-card .meta .when { margin-left: auto; }
.note-card .text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 4px 0; }
.note-card details { margin: 0; }
.task { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--border); }
.task .t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.task .tm { display: flex; gap: 4px 12px; flex-wrap: wrap; align-items: center; margin-top: 2px; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.task.done .t > span:first-child { color: var(--ink-muted); text-decoration: line-through; }
.task.late .due { color: var(--danger); font-weight: 500; }
button.check { width: 20px; height: 20px; flex: 0 0 20px; margin-top: 1px; border: 1.5px solid var(--border-control);
               border-radius: 5px; background: var(--surface); color: var(--on-primary); font-weight: 700; line-height: 1;
               padding: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }
button.check:hover { border-color: var(--ink); }
.task.done button.check { background: var(--ink); border-color: var(--ink); }
@media (max-width: 600px) { .inrow { flex-wrap: wrap; } table.list td:nth-child(5), table.list th:nth-child(5) { display: none; } }
pre.token { background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 8px 10px;
            overflow-x: auto; user-select: all; font: 13px/18px var(--font-mono); }
.token-new { border-color: var(--success); }

/* документы */
.dstatus { display: inline-flex; align-items: center; height: 22px; font-size: 12px; font-weight: 500; padding: 0 8px; border-radius: var(--radius-sm);
           background: var(--surface-sunken); color: var(--ink); white-space: nowrap; }
.d-draft, .d-cancelled { color: var(--ink-muted); }
.d-review, .d-sent { background: var(--warning-soft); color: var(--warning); }
.d-signed, .d-paid { background: var(--success-soft); color: var(--success); }
.d-cancelled { text-decoration: line-through; }
.doc-row { display: flex; gap: 8px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--border); }
.doc-row .t { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 14px; line-height: 20px; }
iframe.pdf { width: 100%; height: 78vh; border: 1px solid var(--border); border-radius: var(--radius-xl); background: #fff; }
textarea.code { font: 12.5px/1.45 var(--font-mono); white-space: pre; tab-size: 2; }
.form.wide { max-width: none; }
.ver { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.ver.cur { background: var(--surface-sunken); border-radius: var(--radius-md); padding: 8px; }
.ver .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: baseline; }
.ver .meta .when { margin-left: auto; }
.comment { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 8px 12px; margin-bottom: 8px; }
.comment .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.imgfield { display: flex; gap: 10px; align-items: center; color: var(--ink); }
.imgfield img { width: 72px; height: 72px; object-fit: contain; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-md); }

/* ---------------------------------------------------------------- карточка клиента */
.c-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 4px 0 20px; }
.c-head h1 { margin: 0; }
.c-sub { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; font-size: 14px; color: var(--ink-muted); }
.crumbs { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.crumbs a { color: var(--ink-muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.c-cols { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.c-main { flex: 999 1 620px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.c-side { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-panel); padding: 20px 24px; }
@media (max-width: 600px) { .panel { padding: 16px; } }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; }
.panel-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.count { font-size: 13px; color: var(--ink-muted); }
.label { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink-muted); letter-spacing: 0.02em; text-transform: uppercase; margin: 0; }
.sep { height: 1px; background: var(--border); margin: 16px 0; }
.fold > summary { list-style: none; }
.fold > summary::-webkit-details-marker { display: none; }
.fold[open] > summary { margin-bottom: 8px; }
.subform { background: var(--surface-subtle); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 14px; margin-top: 8px; }
.subform .form { max-width: none; }

/* паспорт */
.company { display: flex; gap: 14px; align-items: flex-start; }
.logo-sq { width: 48px; height: 48px; border-radius: var(--radius-lg); background: var(--surface-sunken); display: flex;
           align-items: center; justify-content: center; font-weight: 600; font-size: 20px; flex: none; }
.kv { display: grid; grid-template-columns: 104px minmax(0, 1fr); row-gap: 8px; column-gap: 12px; font-size: 14px; line-height: 20px; margin: 16px 0 0; }
.kv dt { color: var(--ink-muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.person { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.ava { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-sunken); color: var(--ink); font-size: 13px; font-weight: 600;
       display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ava.sm { width: 22px; height: 22px; font-size: 11px; }
.reach { display: flex; gap: 4px 12px; flex-wrap: wrap; margin-top: 2px; font-size: 13px; line-height: 18px; color: var(--ink-muted); }

/* проекты */
.proj { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.proj + .proj { margin-top: 10px; }
.proj.closed { background: var(--surface-subtle); }
.proj-top { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.proj-name { font-size: 15px; line-height: 22px; font-weight: 600; }
.money { margin-left: auto; text-align: right; font-size: 15px; line-height: 22px; font-weight: 600; white-space: nowrap; }
.money small { display: block; font-size: 13px; line-height: 18px; font-weight: 400; color: var(--ink-muted); }
.steps { display: flex; gap: 3px; }
.steps i { flex: 1; height: 6px; border-radius: 3px; background: var(--canvas-line); }
.steps i.done { background: var(--border-control); }
.steps i.cur { background: var(--ink); }
.proj-foot { display: flex; gap: 6px 14px; align-items: center; flex-wrap: wrap; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.proj-foot b { color: var(--ink); font-weight: 500; }
.proj-foot .right { margin-left: auto; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--radius-sm); background: var(--surface-sunken);
       font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink); white-space: nowrap; }
.proj-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.proj-actions form { margin: 0; }

/* задачи */
.add-task { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 4px; }
.add-task > input[name=text] { flex: 1 1 260px; min-width: 0; }
.add-task input[type=date], .add-task select, .add-task input[name=assignee] { width: auto; flex: 0 1 150px; }

/* таймлайн */
.composer { border: 1px solid var(--border-control); border-radius: var(--radius-lg); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.composer:focus-within { border-color: var(--ink); }
.composer textarea { border: 0; outline: none; resize: vertical; background: transparent; min-height: 48px; padding: 2px 0; }
.composer textarea:focus { outline: none; }
.composer-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.composer-bar select, .composer-bar input[type=date] { width: auto; height: 32px; min-height: 32px; padding: 4px 8px; font-size: 13px; }
.composer .more { font-size: 13px; }
.composer .more summary { font-size: 13px; color: var(--ink-muted); }
.tl { position: relative; padding-left: 28px; margin-top: 8px; }
.tl::before { content: ""; position: absolute; left: 8px; top: 8px; bottom: 8px; width: 2px; background: var(--canvas-line); border-radius: 1px; }
.tl-day { position: relative; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink-muted); margin: 22px 0 8px; }
.tl-day::before { content: ""; position: absolute; left: -24px; top: 4px; width: 10px; height: 10px; border-radius: 50%;
                  background: var(--surface); border: 2px solid var(--border-control); }
.tl-ev { position: relative; display: flex; gap: 8px; align-items: baseline; padding: 4px 0; font-size: 14px; line-height: 20px; color: var(--ink-muted); }
.tl-ev::before { content: ""; position: absolute; left: -22px; top: 11px; width: 6px; height: 6px; border-radius: 50%; background: var(--border-control); }
.tl-ev .when, .tl-card .when { margin-left: auto; }
.tl-card { position: relative; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 10px 14px; margin: 8px 0; background: var(--surface-subtle); }
.tl-card::before { content: ""; position: absolute; left: -24px; top: 16px; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); }
.tl-card.in { background: var(--bubble-out); border-color: transparent; }
.tl-card.internal { background: var(--accent-soft); border-color: var(--accent-border); }
.tl-card.failed { border-color: var(--danger); }
.tl-meta { display: flex; gap: 6px 8px; align-items: center; flex-wrap: wrap; font-size: 13px; line-height: 18px; color: var(--ink-muted); margin-bottom: 4px; }
.tl-meta b { color: var(--ink); font-weight: 600; }
.tl-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.tl-card details { margin: 6px 0 0; }
.tl-card details summary { font-size: 13px; color: var(--ink-muted); font-weight: 400; }
.pinned { margin-bottom: 8px; }
.pinned .tl-card::before { display: none; }

/* ---------------------------------------------------------------- воронка */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-panel); padding: 14px 18px; }
.kpi-n { font-size: 24px; line-height: 30px; font-weight: 600; letter-spacing: -0.01em; margin-top: 4px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar select { width: auto; height: 32px; min-height: 32px; padding: 4px 8px; font-size: 13px; }
.board { overflow-x: auto; padding-bottom: 8px; }
.lanes { display: flex; gap: 8px; min-width: 1320px; align-items: flex-start; }
.lane { flex: 1 0 158px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.lane-head { padding: 4px 4px 6px; border-bottom: 2px solid var(--canvas-line); }
.lane-head.after { border-bottom-color: var(--border-control); }
.lane-title { display: flex; gap: 6px; align-items: baseline; font-size: 14px; line-height: 20px; font-weight: 600; }
.lane-sum { font-size: 13px; line-height: 18px; color: var(--ink-muted); min-height: 18px; }
.deal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-panel);
        padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.deal:hover { border-color: var(--border-control); }
.deal a.name { font-size: 14px; line-height: 20px; font-weight: 600; text-decoration: none; }
.deal a.name:hover { text-decoration: underline; }
.deal .client { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.deal .sum { font-size: 15px; line-height: 22px; font-weight: 600; }
.deal .foot { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.deal .next { font-size: 13px; line-height: 18px; color: var(--ink-muted); border-top: 1px solid var(--border); padding-top: 6px; }
.deal form { margin: 0; }
.deal .move { display: flex; gap: 4px; justify-content: flex-end; }
.deal .move button { height: 24px; min-width: 28px; padding: 0 8px; border-radius: var(--radius-pill); border: 1px solid var(--border);
                     background: var(--surface); color: var(--ink-muted); font: 500 12px/16px var(--font-sans); cursor: pointer; }
.deal .move button:hover { border-color: var(--ink); color: var(--ink); }
.lost { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 16px; padding: 12px 16px; border: 1px dashed var(--border-control);
        border-radius: var(--radius-lg); font-size: 14px; color: var(--ink-muted); }
.lost b { color: var(--ink); font-weight: 600; }
