:root { --sidebar-w: 236px; --brand: #8a5a00; --bs-body-font-size: .9rem; }
body { background: #f4f5f7; }
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: #1f2430; color: #c9ced8; flex-shrink: 0; position: sticky; top: 0;
  height: 100vh; overflow-y: auto; padding-bottom: 2rem; z-index: 1030; }
.sidebar .brand { display: block; padding: 14px 18px; font-weight: 700; font-size: 1.1rem; color: #fff; text-decoration: none;
  border-bottom: 1px solid #2d3343; }
.sidebar .brand i { color: #f2b544; }
.sidebar .nav-section { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: #7d8597; padding: 14px 18px 4px; }
.sidebar .nav-link { color: #c9ced8; padding: 5px 18px; font-size: .87rem; display: block; }
.sidebar .nav-link i { width: 20px; display: inline-block; opacity: .85; }
.sidebar .nav-link:hover { color: #fff; background: #2a3040; }
.sidebar .nav-link.active { color: #fff; background: #343b4f; border-left: 3px solid #f2b544; padding-left: 15px; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: #fff; border-bottom: 1px solid #e3e6eb; padding: 8px 20px; display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 1020; }
.topbar .search { position: relative; flex: 1; max-width: 520px; }
.topbar .search i { position: absolute; left: 10px; top: 6px; color: #8a93a3; }
.topbar .search input { padding-left: 30px; }
.content { padding: 18px 22px 40px; }
.page-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { font-size: 1.35rem; margin: 0; font-weight: 600; }
.page-head .actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.card { border: 1px solid #e3e6eb; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.card-header { background: #fff; font-weight: 600; }
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table-crm { background: #fff; font-size: .86rem; }
.table-crm thead th { background: #f8f9fb; font-weight: 600; color: #4b5363; font-size: .8rem; vertical-align: bottom;
  border-bottom-width: 1px; position: sticky; top: 0; }
.table-crm td { vertical-align: middle; }
.table-crm tr.clickable { cursor: pointer; }
.table-crm tr.clickable:hover td { background: #f5f8ff; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.badge-status { font-weight: 500; }
.text-bg-orange { background: #fd7e14 !important; color: #fff !important; }
.text-bg-purple { background: #6f42c1 !important; color: #fff !important; }
.text-bg-teal { background: #20c997 !important; color: #fff !important; }
.kpi { background: #fff; border: 1px solid #e3e6eb; border-radius: .5rem; padding: 12px 14px; height: 100%; }
.kpi .label { font-size: .75rem; color: #6c757d; text-transform: uppercase; letter-spacing: .03em; }
.kpi .value { font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: .78rem; color: #6c757d; }
.dl-grid { display: grid; grid-template-columns: 190px 1fr; gap: 4px 12px; font-size: .88rem; }
.dl-grid dt { color: #6c757d; font-weight: 400; }
.dl-grid dd { margin: 0; }
.signal { display: flex; gap: 10px; padding: 8px 12px; border-bottom: 1px solid #eef0f3; font-size: .87rem; }
.signal:last-child { border-bottom: 0; }
.signal .ico { font-size: 1.1rem; }
.board { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 10px; }
.board-col { min-width: 250px; width: 250px; background: #eceef2; border-radius: .5rem; padding: 8px; flex-shrink: 0; }
.board-col h6 { font-size: .8rem; text-transform: uppercase; color: #4b5363; display: flex; flex-direction: column; gap: 2px; min-height: 2.6rem; }
.board-col h6 .board-sum { text-transform: none; font-weight: 400; color: #6c757d; font-size: .76rem; }
.board-card { background: #fff; border-radius: .4rem; padding: 8px 10px; margin-bottom: 8px; font-size: .82rem;
  border: 1px solid #e1e4ea; cursor: grab; display: block; color: inherit; text-decoration: none; }
.board-card:hover { border-color: #9db4e8; }
.board-card.drag-over { outline: 2px dashed #6c8fd8; }
.board-col.drag-over { background: #dde5f5; }
.funnel { display: flex; gap: 2px; margin-bottom: 12px; }
.funnel .step { flex: 1; text-align: center; padding: 6px 4px; background: #e9ecef; font-size: .78rem; color: #6c757d;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%); }
.funnel .step:first-child { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); }
.funnel .step.done { background: #cfe2d6; color: #1f5132; }
.funnel .step.current { background: #0d6efd; color: #fff; font-weight: 600; }
button.funnel-btn { border: 0; background: none; padding: 0; width: 100%; color: inherit; font: inherit; }
.progress-thin { height: 6px; }
.form-label { font-size: .82rem; margin-bottom: 2px; color: #4b5363; }
.form-text { font-size: .74rem; }
.formset-row td { padding: 4px; }
.history-diff { font-size: .82rem; }
.muted-small { font-size: .78rem; color: #6c757d; }
.filters .form-select, .filters .form-control { width: auto; min-width: 140px; }
@media (max-width: 991px) {
  .sidebar { position: fixed; left: calc(-1 * var(--sidebar-w)); transition: left .2s; }
  .sidebar.open { left: 0; }
  .content { padding: 12px; }
  .dl-grid { grid-template-columns: 1fr; }
}
@media print { .sidebar, .topbar, .actions, .no-print { display: none !important; } .content { padding: 0; } }
.signal a { text-decoration: none; } .signal a:hover { text-decoration: underline; }
.page-head .actions .form-select { width: auto; }
#items-rows .form-control, #items-rows .form-select { font-size: .84rem; padding-top: .25rem; padding-bottom: .25rem; }
#items-rows .form-select { padding-left: .5rem; padding-right: 1.6rem; background-position: right .4rem center; }
#items-rows td { padding: 4px 3px; }
/* Товари в угоді: картка на рядок замість широкої таблиці */
#items-rows { counter-reset: item; display: flex; flex-direction: column; gap: .85rem; padding: 1rem; }
#items-rows .item-row { counter-increment: item; padding: 1rem 1.25rem 1.1rem; border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius); }
#items-rows .item-row:nth-child(even) { background: var(--bs-tertiary-bg); }
#items-rows .item-row .row { --bs-gutter-y: .75rem; }
#items-rows .item-head { display: flex; align-items: center; gap: .75rem; margin-bottom: .6rem; padding-bottom: .5rem; border-bottom: 1px dashed var(--bs-border-color); font-size: .84rem; }
#items-rows .item-no::before { content: "Товар " counter(item); font-weight: 600; }
#items-rows .item-del, #items-rows .item-undo { padding: .1rem .5rem; font-size: .8rem; }
#items-rows .item-undo, #items-rows .item-deleted-msg { display: none; }
#items-rows .item-row.is-deleted { counter-increment: none; opacity: .65; border-style: dashed; background: none; padding-bottom: .6rem; }
#items-rows .item-row.is-deleted .item-head { margin: 0; padding: 0; border: 0; }
#items-rows .item-row.is-deleted :is(.item-body, .item-no, .line-sum, .item-del) { display: none; }
#items-rows .item-row.is-deleted :is(.item-undo, .item-deleted-msg) { display: inline-block; }
#items-rows .item-deleted-msg { color: var(--bs-secondary-color); font-style: italic; }
#items-rows .item-label { display: block; font-size: .75rem; color: var(--bs-secondary-color); margin-bottom: .15rem; }
#items-rows .qty-group .form-control { min-width: 0; }
#items-rows .qty-group .form-select { flex: 0 0 5.2rem; width: 5.2rem; }
#items-rows .free { color: var(--bs-success-text-emphasis); }
.items-total { padding: .25rem 1.25rem 1rem; text-align: right; }
.form-section { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: #6c757d; font-weight: 600;
  margin: 1.4rem 0 .6rem; padding-bottom: .35rem; border-bottom: 1px solid #e3e6eb; }
.filters .form-select { max-width: 280px; }
/* жовті контурні кнопки: темніший текст, щоб читалися на білому */
.btn-outline-warning { --bs-btn-color: #8a6100; --bs-btn-border-color: #e0a800; --bs-btn-hover-color: #000; }
/* кнопка у flex-рядку не розтягується на висоту сусіднього блоку */
.d-flex:not(.flex-column) > .btn, .d-flex:not(.flex-column) > form > .btn { align-self: center; }
.btn { white-space: nowrap; }
