/* CRM КубаньСтрой — оформление. Тёмный #182630 и золото #e3c28e — как на сайте; рабочие поверхности светлые. */
:root {
  --ink: #182630; --ink-2: #2b3d4a; --muted: #6b7f8c; --line: #dfe5ea; --bg: #f2f5f7; --card: #fff;
  --gold: #e3c28e; --gold-ink: #8a6a35; --blue: #2f6fae; --red: #c0503f; --green: #2e8b57; --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; }
h3 { font-size: 13px; margin: 20px 0 8px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.ok { color: var(--green); margin: 0 0 10px; }
.alert { background: #fbeae7; color: var(--red); padding: 10px 12px; border-radius: 8px; }

/* шапка */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; padding: 10px 20px; background: var(--ink); color: #e9eef2; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; font-size: 15px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand b { color: var(--gold); font-weight: 600; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; background: var(--gold); color: var(--ink); font-weight: 700; }
.brand-lg { font-size: 18px; color: var(--ink); margin-bottom: 8px; }
.nav { display: flex; gap: 4px; }
.nav a { color: #c6d1d9; padding: 6px 12px; border-radius: 7px; }
.nav a:hover { background: #ffffff12; text-decoration: none; color: #fff; }
.nav a.on { background: #ffffff1c; color: #fff; }
.search { flex: 1; max-width: 420px; }
.search input { width: 100%; padding: 8px 12px; border-radius: 8px; border: 1px solid #ffffff24; background: #ffffff10; color: #fff; font: inherit; }
.search input::placeholder { color: #9fb0bc; }
.me { margin-left: auto; color: #c6d1d9; white-space: nowrap; }
.me a { color: var(--gold); margin-left: 8px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-wide { width: 100%; padding: 11px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

.main { padding: 20px; }

/* вход */
body.is-login { display: grid; place-items: center; min-height: 100vh; background: var(--ink); }
body.is-login .main { padding: 16px; width: 100%; display: grid; place-items: center; }
.login-card { width: min(380px, 100%); background: #fff; border-radius: 14px; padding: 28px; box-shadow: 0 20px 50px #0004; }
.login-card form { display: grid; gap: 14px; margin-top: 16px; }
.login-card label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.login-card input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; color: var(--ink); }
.notice { background: #e9f4ee; color: #22603f; padding: 10px 12px; border-radius: 8px; }

/* доска */
.board { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding-bottom: 12px; min-height: calc(100vh - 100px); }
.col { flex: 0 0 272px; background: #e8edf1; border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 110px); }
.col-head { padding: 12px 12px 8px; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; border-top: 3px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.col-new .col-head { border-color: #8fb3d6; }
.col-work .col-head { border-color: var(--gold); }
.col-prepay .col-head { border-color: #7bbf93; }
.col-ready .col-head { border-color: #4f9d6e; }
.col-installed .col-head { border-color: var(--ink-2); }
.col-head h2 { margin: 0; font-size: 13px; }
.col-count { font-size: 12px; color: var(--muted); background: #fff; border-radius: 20px; padding: 0 8px; }
.col-sum { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.col-body { padding: 4px 8px 10px; overflow-y: auto; display: grid; gap: 8px; align-content: start; min-height: 60px; }
.col-body.drag-over, .drop-target.drag-over { outline: 2px dashed var(--gold); outline-offset: -2px; background: #fff6; }
.card { position: relative; background: var(--card); border-radius: 8px; box-shadow: 0 1px 2px #18263018; border: 1px solid #e3e8ec; }
.card.dragging { opacity: .5; }
.card-link { display: block; padding: 10px 12px; color: var(--ink); }
.card-link:hover { text-decoration: none; }
.card:hover { border-color: #c9d3da; }
.card-title { font-weight: 500; line-height: 1.35; padding-right: 14px; }
.card-client { font-size: 12px; color: var(--muted); margin-top: 3px; }
.card-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }
.card-meta b { color: var(--ink); font-weight: 600; }
.card-call { position: absolute; top: 8px; right: 10px; color: var(--green); font-size: 12px; }
.card-take { padding: 0 12px 9px; font-size: 12px; }
.col-more { display: block; text-align: center; font-size: 12px; padding: 6px; }
.col-closed { flex-basis: 200px; }
.col-drop-only { gap: 10px; }
.drop-target { border: 1px dashed #b9c5cd; border-radius: 8px; padding: 18px 10px; text-align: center; color: var(--green); font-size: 13px; }
.drop-target.lost { color: var(--red); }

/* карточка сделки */
.deal-head { margin-bottom: 14px; }
.back { display: inline-block; margin-bottom: 8px; font-size: 13px; }
.stages { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; }
.stages form { margin: 0; }
.stage { border: 1px solid var(--line); background: #fff; color: var(--ink-2); padding: 7px 12px; border-radius: 7px; font: inherit; font-size: 13px; cursor: pointer; }
.stage:hover { border-color: #b9c5cd; }
.stage.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.stage-work.on { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.stage-won.on { background: var(--green); border-color: var(--green); }
.stage-lost.on { background: var(--red); border-color: var(--red); }
.deal-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.panel { background: #fff; border-radius: 12px; padding: 18px 20px; border: 1px solid #e3e8ec; }
.panel.narrow { max-width: 640px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.fields label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.fields .wide { grid-column: 1 / -1; }
.fields .check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 13px; }
.fields input:not([type=checkbox]), .fields select, .fields textarea, .comment-form textarea, .filters input, .filters select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; font: inherit; color: var(--ink); background: #fff; }
.fields input:focus, .fields select:focus, .fields textarea:focus, .comment-form textarea:focus { outline: 2px solid #e3c28e88; border-color: var(--gold); }
.client { display: grid; gap: 4px; margin-bottom: 20px; }
.client-name { font-size: 17px; font-weight: 600; }
.phone { font-size: 15px; }
.edit-client summary { cursor: pointer; color: var(--blue); font-size: 13px; margin-top: 4px; }
.edit-client .fields { margin-top: 10px; }
.comment-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; margin-bottom: 14px; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.feed-item { border-left: 3px solid var(--line); padding: 6px 0 6px 12px; }
.feed-item.call { border-color: #7bbf93; }
.feed-item.call.missed { border-color: var(--red); }
.feed-item.ev-comment { border-color: var(--gold); }
.feed-item.ev-stage { border-color: var(--ink-2); }
.feed-item.ev-webform, .feed-item.lead { border-color: #8fb3d6; }
.feed-head { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; }
.feed-kind { font-weight: 600; }
.feed-text { margin-top: 3px; white-space: normal; word-break: break-word; }
.feed audio, .tbl audio { height: 32px; width: 100%; max-width: 360px; margin-top: 4px; }
.files { margin: 0; padding-left: 18px; }

/* списки */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.filters { display: flex; gap: 8px; }
.filters input { width: 240px; }
.tabs { display: flex; gap: 4px; }
.tabs a { padding: 6px 12px; border-radius: 7px; background: #fff; border: 1px solid var(--line); color: var(--ink-2); }
.tabs a.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tbl { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; }
.tbl th, .tbl td { text-align: left; padding: 9px 12px; border-bottom: 1px solid #edf1f4; vertical-align: top; }
.tbl th { font-size: 12px; color: var(--muted); font-weight: 500; background: #fafbfc; }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl-deals tbody tr { cursor: pointer; }
.tbl-deals tbody tr:hover { background: #f7f9fb; }
.row-missed td:nth-child(2) { color: var(--red); }
.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 20px; background: #edf1f4; white-space: nowrap; }
.pill-work { background: #f6ecda; }
.pill-prepay, .pill-ready { background: #e2f1e7; }
.pill-won { background: #dcefe3; color: var(--green); }
.pill-lost { background: #f8e4e0; color: var(--red); }
.pager { display: flex; gap: 4px; margin-top: 14px; flex-wrap: wrap; }
.pager a, .pager span { padding: 4px 10px; border-radius: 6px; background: #fff; border: 1px solid var(--line); }
.pager a.on { background: var(--ink); color: #fff; }
.empty { text-align: center; padding: 60px 0; }

@media (max-width: 900px) {
  .top { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .search { order: 5; flex-basis: 100%; max-width: none; }
  .main { padding: 14px; }
  .deal-grid { grid-template-columns: 1fr; }
  .fields { grid-template-columns: 1fr; }
  .col { flex-basis: 84vw; }
  .tbl-deals td:nth-child(1), .tbl-deals th:nth-child(1), .tbl-deals td:nth-child(6), .tbl-deals th:nth-child(6) { display: none; }
  .tbl:not(.tbl-deals) { display: block; overflow-x: auto; }       /* таблица звонков листается внутри себя, страница — нет */
  .tbl audio { min-width: 220px; }
}

/* v2 (04.11.2026): заявки и договоры, сводка, деньги, закупки */
.board-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.board-head p { margin: 0; }
.col-site_paid .col-head { border-color: var(--gold); }
.col-production .col-head { border-color: #8fb3d6; }
.col-done .col-head { border-color: var(--green); }
.col-empty { text-align: center; color: #9fb0bc; font-size: 12px; padding: 10px 0; }
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.card-tags:empty { display: none; }
.tag { display: inline-block; font-size: 11px; line-height: 1.6; padding: 0 7px; border-radius: 20px; background: #edf1f4; color: var(--ink-2); white-space: nowrap; }
.tag-shop { background: #f6ecda; color: var(--gold-ink); }
.card-money { font-size: 13px; font-weight: 600; margin-top: 4px; }
.card-money .left { color: var(--gold-ink); font-weight: 500; }
.card-purch { font-size: 12px; color: var(--red); margin-top: 4px; }
.card-warn { border-left: 3px solid var(--red); }
.late { color: var(--red); font-weight: 600; }
.warn, .warn-c { color: var(--red); }
.ok-c { color: var(--green); }
.danger { color: var(--red) !important; }
.btn-danger { background: var(--red); color: #fff; }
.btn { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }

.dash-head { margin-bottom: 14px; }
.dash-head p { margin: 2px 0 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile { background: #fff; border: 1px solid #e3e8ec; border-radius: 12px; padding: 14px 16px; color: var(--ink); display: grid; gap: 4px; }
.tile:hover { text-decoration: none; border-color: #c9d3da; }
.tile b { font-size: 24px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.tile span { font-size: 12px; color: var(--muted); line-height: 1.35; }
.tile-alert { border-color: #f0c2b9; background: #fdf3f1; }
.tile-alert b { color: var(--red); }
.tile-warn { border-color: #ecd9b6; background: #fdf8ef; }
.tile-gold { border-color: var(--gold); background: #fcf6ea; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; align-items: start; }
.dash-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.dash-list li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }

.deal-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 16px; }
.actions form { margin: 0; }
.actions-gap { flex: 1; }
.notice { background: #fcf6ea; border: 1px solid var(--gold); border-radius: 8px; padding: 7px 12px; font-size: 13px; }
.pop { position: relative; }
.pop > summary { list-style: none; cursor: pointer; }
.pop > summary::-webkit-details-marker { display: none; }
.pop-body { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: min(520px, 92vw); background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; box-shadow: 0 16px 40px #18263026; }
.pop-right .pop-body { left: auto; right: 0; }
.confirm-box { background: #fdf3f1; border: 1px solid #f0c2b9; border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.confirm-box ul { margin: 8px 0 12px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-form input { flex: 1; min-width: 220px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; font: inherit; }
.col-left { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.hint { font-size: 11px; color: var(--gold-ink); }
.money { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.money div { background: #f7f9fb; border-radius: 9px; padding: 10px 12px; display: grid; }
.money span { font-size: 12px; color: var(--muted); }
.money b { font-size: 18px; font-weight: 600; }
.money small { font-size: 11px; color: var(--muted); }
.tbl-mini { font-size: 13px; }
.tbl-mini td { padding: 6px 8px; }
.add-row { margin-top: 10px; }
.add-row > summary { list-style: none; cursor: pointer; display: inline-block; margin-bottom: 8px; }
.add-row > summary::-webkit-details-marker { display: none; }
.purchase { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; display: grid; gap: 8px; }
.purchase.is-open { border-left: 3px solid var(--red); }
.purchase.is-closed { border-left: 3px solid var(--green); background: #fbfdfb; }
.purchase-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.purchase-head select, .purchase-fields input, .upload select, .upload input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; font: inherit; font-size: 13px; background: #fff; }
.purchase-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 6px; }
.purchase-fields input { min-width: 0; width: 100%; }
.purchase-head select { max-width: 50%; }
.purchase-foot { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; font-size: 13px; }
.file-btn { color: var(--blue); cursor: pointer; }
.file-btn input { display: none; }
.upload { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.files li { margin-bottom: 4px; }
.pill-new { background: #e6eff8; }
.pill-refused, .pill-cancelled { background: #f8e4e0; color: var(--red); }
.pill-site_paid { background: #f6ecda; }
.pill-production { background: #e6eff8; }
.pill-done { background: #dcefe3; color: var(--green); }

@media (max-width: 1100px) {
  .deal-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .purchase-fields { grid-template-columns: 1fr 1fr; }
  .money { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .pop-body { position: fixed; left: 8px !important; right: 8px; top: 70px; width: auto; }
}
