/* Твоя лоза — CRM. */
:root {
  --bg: #f4f2ee; --panel: #fff; --ink: #1c1915; --ink-2: #3b352e; --muted: #857c71; --line: #e7e2da; --line-2: #d8d0c4; --hover: #faf8f4;
  --side: #17130f; --side-2: #241e18; --side-ink: #cfc6b8;
  --gold: #b08d4f; --gold-2: #8f6f37; --gold-bg: #f6efe2;
  --ok: #2e7d4f; --ok-bg: #e4f2e9; --warn: #b7741a; --warn-bg: #fdf0da; --bad: #c0392b; --bad-bg: #fbe7e4; --blue: #2b62a8; --blue-bg: #e8f0fb;
  --r: 12px; --sh: 0 1px 2px rgba(40, 30, 20, .05), 0 4px 16px rgba(40, 30, 20, .05); --sh-2: 0 12px 40px rgba(30, 20, 10, .18);
  font: 14px/1.45 Manrope, system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 14px; } h4 { font-size: 13px; }
.muted { color: var(--muted); }
small, .sm { font-size: 12px; color: var(--muted); }
.ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ico.s { width: 15px; height: 15px; }

/* каркас */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 16px 10px; overflow-y: auto; }
.side .brand { display: flex; gap: 10px; align-items: center; padding: 2px 10px 18px; }
.side .brand img { width: 30px; height: 30px; }
.side .brand b { font: 500 18px/1 "Cormorant Garamond", Georgia, serif; letter-spacing: .14em; text-transform: uppercase; color: #f1e9dc; }
.side .brand small { display: block; color: #8e8577; font-size: 10px; letter-spacing: .22em; text-transform: uppercase; margin-top: 4px; }
.side a { color: var(--side-ink); padding: 8px 10px; border-radius: 9px; display: flex; gap: 10px; align-items: center; font-weight: 500; font-size: 13.5px; text-decoration: none; }
.side a:hover { background: var(--side-2); color: #fff; }
.side a.on { background: linear-gradient(90deg, rgba(176, 141, 79, .28), rgba(176, 141, 79, .08)); color: #fff; box-shadow: inset 2px 0 0 var(--gold); }
.side a .n { margin-left: auto; background: var(--bad); color: #fff; border-radius: 10px; font-size: 11px; padding: 0 7px; line-height: 18px; font-weight: 700; }
.side a .n.g { background: #3d352c; color: #e9dfcf; }
.side .grp { font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: #6f675c; padding: 16px 10px 6px; }
.side .me { margin-top: auto; padding: 12px 10px 4px; display: flex; gap: 10px; align-items: center; border-top: 1px solid #2b241d; }
.side .me .av { width: 32px; height: 32px; font-size: 12px; }
.side .me b { display: block; color: #f1e9dc; font-size: 13px; font-weight: 600; }
.side .me button { background: none; border: 0; color: #8e8577; cursor: pointer; padding: 0; font-size: 12px; }
.side .me button:hover { color: #fff; }
.main { min-width: 0; display: flex; flex-direction: column; }
.bar { position: sticky; top: 0; z-index: 30; display: flex; gap: 12px; align-items: center; padding: 12px 24px; background: rgba(244, 242, 238, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.gsearch { position: relative; flex: 1; max-width: 520px; }
.gsearch input { width: 100%; padding: 9px 12px 9px 36px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; outline: none; }
.gsearch input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(176, 141, 79, .15); }
.gsearch .ico { position: absolute; left: 11px; top: 10px; color: var(--muted); }
.gsearch kbd { position: absolute; right: 9px; top: 8px; font: 600 11px/1 Manrope, sans-serif; color: var(--muted); border: 1px solid var(--line-2); border-radius: 5px; padding: 3px 5px; background: var(--hover); }
.gres { position: absolute; top: 44px; left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--sh-2); padding: 6px; max-height: 70vh; overflow-y: auto; }
.gres h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 8px 10px 4px; }
.gres a { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.gres a:hover, .gres a.sel { background: var(--gold-bg); }
.gres a small { white-space: nowrap; }
.content { padding: 20px 24px 60px; }
.head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.head h1 { margin-right: auto; display: flex; gap: 10px; align-items: baseline; }
.head h1 small { font-size: 14px; font-weight: 500; }

/* элементы */
.btn { display: inline-flex; gap: 7px; align-items: center; border: 1px solid var(--ink); background: var(--ink); color: #fff; border-radius: 9px; padding: 8px 14px; cursor: pointer; font-weight: 600; font-size: 13px; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: #000; }
.btn.gold { background: var(--gold); border-color: var(--gold); } .btn.gold:hover { background: var(--gold-2); }
.btn.line { background: #fff; color: var(--ink); border-color: var(--line-2); } .btn.line:hover { border-color: var(--ink-2); }
.btn.ghost { background: none; border-color: transparent; color: var(--ink-2); } .btn.ghost:hover { background: rgba(0, 0, 0, .05); }
.btn.bad { background: #fff; color: var(--bad); border-color: #efcfca; } .btn.bad:hover { background: var(--bad-bg); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn.icon { padding: 7px; }
.btn:disabled { opacity: .45; cursor: default; }
.in { border: 1px solid var(--line-2); background: #fff; border-radius: 9px; padding: 8px 10px; width: 100%; outline: none; transition: border-color .15s, box-shadow .15s; }
.in:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(176, 141, 79, .15); }
select.in { padding-right: 28px; }
textarea.in { resize: vertical; }
.in.auto { width: auto; }
label.f { display: grid; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 500; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.seg { display: inline-flex; background: #ebe6de; border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 12px; cursor: pointer; font-size: 12.5px; border-radius: 7px; font-weight: 600; color: var(--ink-2); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.chip { display: inline-flex; gap: 5px; align-items: center; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip .n { background: var(--bad); color: #fff; border-radius: 8px; padding: 0 5px; font-size: 10.5px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; background: var(--gold-bg); color: var(--gold-2); margin: 0 4px 2px 0; }
.pill { display: inline-flex; gap: 4px; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: #eee9e1; color: var(--ink-2); white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); } .pill.bad { background: var(--bad-bg); color: var(--bad); } .pill.warn { background: var(--warn-bg); color: var(--warn); } .pill.blue { background: var(--blue-bg); color: var(--blue); }
.av { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 10.5px; font-weight: 700; color: #fff; flex: none; letter-spacing: .02em; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--sh); }
.card > h3 { margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.empty { padding: 26px; text-align: center; color: var(--muted); font-size: 13px; }
.msg { min-height: 18px; font-size: 13px; color: var(--ok); }
.msg.err { color: var(--bad); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px; z-index: 90; font-size: 13px; font-weight: 600; box-shadow: var(--sh-2); }

/* рабочий стол */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--sh); position: relative; overflow: hidden; }
.kpi small { font-weight: 600; text-transform: uppercase; letter-spacing: .06em; font-size: 10.5px; }
.kpi b { display: block; font-size: 24px; margin-top: 6px; letter-spacing: -.02em; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.hot b { color: var(--bad); } .kpi.go b { color: var(--ok); }
.kpi a.cover { position: absolute; inset: 0; }
.progress { height: 8px; background: #eee7dc; border-radius: 5px; overflow: hidden; margin-top: 10px; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), #d0b076); border-radius: 5px; }
.home { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; }
.home .col2 { display: grid; gap: 14px; align-content: start; }
.mini { display: grid; gap: 2px; }
.mini a, .mini .r { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; align-items: center; }
.mini a:hover { background: var(--hover); }
.mini b { font-weight: 600; font-size: 13px; }
.mini small { display: block; }
.lead-row { display: grid; grid-template-columns: 26px 1fr 60px 120px; gap: 10px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.lead-row:last-child { border-bottom: 0; }

/* канбан */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .sp { flex: 1; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 14px; align-items: start; min-height: 60vh; }
.col { background: #ebe7e0; border-radius: var(--r); min-height: 160px; display: flex; flex-direction: column; }
.col .ch { padding: 12px 12px 10px; border-top: 3px solid var(--c, var(--gold)); border-radius: var(--r) var(--r) 0 0; }
.col .ch h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-2); display: flex; justify-content: space-between; }
.col .ch .sum { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; justify-content: space-between; }
.col .cb { padding: 0 8px 8px; display: grid; gap: 7px; min-height: 60px; }
.col.over { background: #e3dccf; outline: 2px dashed var(--gold); outline-offset: -2px; }
.col .qa { border: 1px dashed var(--line-2); background: rgba(255, 255, 255, .5); border-radius: 9px; padding: 7px 10px; font-size: 12px; color: var(--muted); cursor: pointer; text-align: left; }
.col .qa:hover { background: #fff; color: var(--ink); }
.dc { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px; cursor: pointer; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); transition: border-color .15s, box-shadow .15s, transform .15s; position: relative; }
.dc:hover { border-color: var(--line-2); box-shadow: var(--sh); }
.dc.dragging { opacity: .4; }
.dc .t1 { display: flex; justify-content: space-between; gap: 8px; }
.dc b { font-size: 13px; line-height: 1.3; font-weight: 600; }
.dc .amt { font-weight: 700; font-size: 13px; white-space: nowrap; }
.dc .who { font-size: 12px; color: var(--muted); margin-top: 3px; }
.dc .t3 { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 8px; }
.dc .t3 .l { display: flex; align-items: center; gap: 6px; min-width: 0; }
.dc .t3 .av { width: 22px; height: 22px; font-size: 9.5px; }
.dc .days { font-size: 11px; color: var(--muted); white-space: nowrap; }
.dc .due { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--blue-bg); color: var(--blue); white-space: nowrap; }
.dc .due.late { background: var(--bad-bg); color: var(--bad); } .dc .due.today { background: var(--warn-bg); color: var(--warn); } .dc .due.none { background: #f3eee6; color: var(--muted); font-weight: 600; }
.dc.stale::before { content: ""; position: absolute; left: -1px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--warn); }
.qform { background: #fff; border-radius: 10px; padding: 8px; display: grid; gap: 6px; box-shadow: var(--sh); }

/* таблицы */
.tbl { background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: auto; box-shadow: var(--sh); max-height: calc(100vh - 190px); }
table.t { width: 100%; border-collapse: collapse; }
table.t th, table.t td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 13px; }
table.t th { background: #faf8f4; font-weight: 700; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; position: sticky; top: 0; z-index: 1; white-space: nowrap; }
table.t th.sort { cursor: pointer; } table.t th.sort:hover { color: var(--ink); }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: var(--hover); }
table.t tr.sel td { background: var(--gold-bg); }
table.t td small { display: block; }
table.t td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.t input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--ink); }
.bulk { position: sticky; bottom: 16px; margin: 12px auto 0; width: fit-content; max-width: 100%; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--ink); color: #fff; padding: 9px 12px; border-radius: 12px; box-shadow: var(--sh-2); z-index: 20; }
.bulk select { background: #2e2822; color: #fff; border-color: #4a4138; }
.bulk .btn.line { background: #2e2822; color: #fff; border-color: #4a4138; }

/* задачи */
.tasks { background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); overflow: hidden; }
.tk { display: grid; grid-template-columns: 24px 1fr auto; gap: 12px; align-items: start; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.tk:last-child { border-bottom: 0; }
.tk:hover { background: var(--hover); }
.tk input[type=checkbox] { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--ok); cursor: pointer; }
.tk .ti { font-weight: 600; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tk .sub { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; }
.tk .d { font-size: 12px; text-align: right; white-space: nowrap; color: var(--muted); }
.tk .d.late { color: var(--bad); font-weight: 700; }
.tk.done .ti { text-decoration: line-through; color: var(--muted); }
.kind { display: inline-flex; gap: 4px; align-items: center; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; background: #f2ece2; color: #6b5a40; }
.kind.call { background: var(--ok-bg); color: var(--ok); } .kind.email { background: var(--blue-bg); color: var(--blue); } .kind.msg { background: #eee7fb; color: #6b45b5; }
.kind.meeting { background: var(--warn-bg); color: var(--warn); } .kind.invoice, .kind.payment { background: #e3f3f1; color: #19786d; } .kind.stage, .kind.system { background: #f0ede8; color: var(--muted); }
.grp-h { display: flex; align-items: center; gap: 8px; margin: 18px 0 8px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.grp-h .pill { font-size: 11px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day { background: #fff; border: 1px solid var(--line); border-radius: 10px; min-height: 260px; padding: 8px; box-shadow: var(--sh); }
.day.today { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(176, 141, 79, .2); }
.day h4 { font-size: 12px; color: var(--muted); margin-bottom: 8px; display: flex; justify-content: space-between; }
.day .ev { font-size: 12px; padding: 6px 7px; border-radius: 7px; background: #f6f2ec; margin-bottom: 5px; cursor: pointer; border-left: 3px solid var(--gold); }
.day .ev.done { opacity: .5; text-decoration: line-through; }
.day .ev:hover { background: var(--gold-bg); }

/* карточка сделки */
.drawer-bg { position: fixed; inset: 0; background: rgba(20, 15, 10, .35); z-index: 40; animation: fade .15s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(1080px, 100vw); background: var(--bg); z-index: 41; display: flex; flex-direction: column; box-shadow: var(--sh-2); animation: slide .2s ease-out; }
@keyframes slide { from { transform: translateX(40px); opacity: .5; } } @keyframes fade { from { opacity: 0; } }
.dh { background: #fff; border-bottom: 1px solid var(--line); padding: 14px 20px 12px; }
.dh .r1 { display: flex; gap: 10px; align-items: center; }
.dh .r1 h2 { font-size: 19px; margin-right: auto; }
.dh .r2 { display: flex; gap: 14px; align-items: center; margin-top: 4px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.dh .r2 b { color: var(--ink); font-size: 16px; }
.pipe { display: flex; gap: 3px; margin-top: 12px; }
.pipe button { flex: 1; border: 0; background: #ece7df; padding: 7px 4px; font-size: 11.5px; font-weight: 700; cursor: pointer; color: var(--muted); clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%, 8px 50%); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pipe button:first-child { clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%); border-radius: 6px 0 0 6px; }
.pipe button.past { background: #d9ccb4; color: #5d4d33; } .pipe button.cur { background: var(--ink); color: #fff; }
.pipe button.won.cur { background: var(--ok); } .pipe button.lostb { flex: .7; background: var(--bad-bg); color: var(--bad); } .pipe button.lostb.cur { background: var(--bad); color: #fff; }
.pipe button:hover:not(.cur) { filter: brightness(.95); }
.db { flex: 1; overflow: hidden; display: grid; grid-template-columns: 360px 1fr; }
.dl { overflow-y: auto; padding: 16px; border-right: 1px solid var(--line); display: grid; gap: 12px; align-content: start; }
.dr { overflow: hidden; display: flex; flex-direction: column; }
.fields { display: grid; gap: 1px; }
.fld { display: grid; grid-template-columns: 110px 1fr; gap: 8px; padding: 6px 0; font-size: 13px; align-items: baseline; }
.fld > span { color: var(--muted); font-size: 12px; }
.fld .v { word-break: break-word; }
.who-card { display: flex; gap: 10px; align-items: flex-start; }
.who-card .av { width: 36px; height: 36px; font-size: 13px; }
.qa-row { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.items { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.items td { padding: 5px 4px; border-bottom: 1px solid var(--line); }
.items td.num { text-align: right; white-space: nowrap; }
.items tfoot td { font-weight: 700; border: 0; padding-top: 8px; }
.composer { background: #fff; border-bottom: 1px solid var(--line); padding: 12px 16px; }
.composer .tabs { display: flex; gap: 2px; margin-bottom: 10px; }
.composer .tabs button { border: 0; background: none; padding: 6px 12px; font-weight: 700; font-size: 12.5px; color: var(--muted); cursor: pointer; border-radius: 7px; display: inline-flex; gap: 6px; align-items: center; }
.composer .tabs button.on { background: var(--gold-bg); color: var(--gold-2); }
.composer form { display: grid; gap: 8px; }
.composer .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.composer .row > * { flex: 1; min-width: 140px; }
.composer .row > .btn { flex: none; min-width: 0; }
.feed { flex: 1; overflow-y: auto; padding: 8px 16px 30px; }
.feed .dt { position: sticky; top: 0; background: var(--bg); text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); padding: 8px 0 4px; text-transform: uppercase; letter-spacing: .08em; z-index: 1; }
.ev2 { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 8px 0; }
.ev2 .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #ece6dc; color: var(--ink-2); }
.ev2 .dot.call { background: var(--ok-bg); color: var(--ok); } .ev2 .dot.email { background: var(--blue-bg); color: var(--blue); } .ev2 .dot.msg { background: #eee7fb; color: #6b45b5; }
.ev2 .dot.meeting { background: var(--warn-bg); color: var(--warn); } .ev2 .dot.invoice, .ev2 .dot.payment { background: #e3f3f1; color: #19786d; }
.ev2 .bx { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
.ev2.sys .bx { background: transparent; border: 0; padding: 6px 0; color: var(--muted); font-size: 12.5px; }
.ev2 .meta { font-size: 11.5px; color: var(--muted); display: flex; gap: 8px; margin-bottom: 3px; }
.ev2 .tx { white-space: pre-line; font-size: 13px; }
.ev2.task .bx { border-left: 3px solid var(--warn); }
.ev2.task.late .bx { border-left-color: var(--bad); }
.ev2.task .bx label { display: flex; gap: 8px; align-items: center; cursor: pointer; font-weight: 600; }

/* модалка */
.modal-bg { position: fixed; inset: 0; background: rgba(20, 15, 10, .4); z-index: 60; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { background: #fff; border-radius: 14px; padding: 22px; width: min(600px, 100%); max-height: 92vh; overflow-y: auto; box-shadow: var(--sh-2); display: grid; gap: 14px; }
.modal.wide { width: min(820px, 100%); }
.modal .row { display: flex; gap: 8px; justify-content: flex-end; }
.tpl { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.tpl:hover, .tpl.on { border-color: var(--gold); background: var(--gold-bg); }

/* отчёт */
.rep { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.fun { display: grid; gap: 6px; }
.fun .r { display: grid; grid-template-columns: 150px 1fr 70px; gap: 10px; align-items: center; font-size: 12.5px; }
.fun .bar2 { height: 22px; background: #f0ebe3; border-radius: 6px; overflow: hidden; position: relative; }
.fun .bar2 i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #c9a66b, #b08d4f); border-radius: 6px; }
.fun .bar2 span { position: relative; padding-left: 8px; font-size: 11.5px; font-weight: 700; line-height: 22px; color: #3b2f1c; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 70px; margin-top: 8px; }
.spark i { flex: 1; background: var(--gold); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; }

/* вход */
.login { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(900px 500px at 70% 0%, rgba(176, 141, 79, .25), transparent 60%), var(--side); padding: 16px; }
.login form { background: #fff; border-radius: 16px; padding: 30px; width: min(390px, 100%); display: grid; gap: 14px; box-shadow: var(--sh-2); }
.login img { width: 42px; }

@media (max-width: 1100px) { .home, .rep { grid-template-columns: 1fr; } .db { grid-template-columns: 1fr; overflow-y: auto; } .dl { border-right: 0; } .dr { overflow: visible; } .feed { overflow: visible; } }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; flex-direction: row; padding: 6px; z-index: 50; overflow-x: auto; gap: 2px; }
  .side .brand, .side .grp, .side .me, .side a .lbl-l { display: none; }
  .side a { flex-direction: column; gap: 2px; font-size: 10.5px; padding: 6px 8px; min-width: 64px; text-align: center; position: relative; }
  .side a .n { position: absolute; top: 2px; right: 6px; margin: 0; }
  .side a.on { box-shadow: none; }
  .content { padding: 14px 12px 90px; }
  .bar { padding: 10px 12px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .board { grid-auto-columns: 84vw; }
  .week { grid-template-columns: 1fr; }
  .day { min-height: 0; }
  .hide-m { display: none; }
  .fld { grid-template-columns: 1fr; gap: 2px; }
  .pipe button { font-size: 10px; }
  .lead-row { grid-template-columns: 26px 1fr 50px; } .lead-row .hide-m { display: none; }
}

/* ничего не должно распирать сетку на узком экране */
.home > *, .home .col2 > *, .rep > *, .grid2 > *, .grid3 > *, .kpis > * { min-width: 0; }
.card .tbl { max-height: none; }
.card table.t { min-width: 0; }
@media (max-width: 860px) { .card { padding: 14px; } .card table.t th, .card table.t td { padding: 7px 8px; font-size: 12px; } .spark { height: 54px; } .fun .r { grid-template-columns: 110px 1fr 46px; } }
