/* Тема ERP HomeStock: білий фон, синій інтерфейс, фірмовий червоний для акцентів і сигналів */
:root, :root[color-mode="light"] {
    --bm-red: #CF0119;
    --bm-red-soft: #FDEBED;
    --bm-blue: #1A3E8C;
    --bm-blue-2: #2F5BBF;
    --bm-blue-soft: #EAF0FB;
    --bm-ink: #1A2540;
    --bm-muted: #66708A;
    --bm-line: #E3E7EF;
    --bm-bg: #FFFFFF;
    --bm-panel: #F7F9FC;
    --bm-green: #1E8E4F;
    --bm-amber: #C77700;
    --bm-font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
    --bm-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;

    --primary_color: var(--bm-blue);
    --secondary_color: var(--bm-red);
    --light_color: var(--bm-blue-soft);
    --background: #FFFFFF;
    --primary_gradient: #FFFFFF;
    --secondary_gradient: #FFFFFF;
    --border_radius: 10px;
    --font_family: var(--bm-font);
    --font_size: 14px;
    --font_weight: 500;
    --font_color: var(--bm-ink);
    --shadow: 0 1px 2px rgba(26, 37, 64, .06);
}

html, body { background: var(--bm-bg) !important; background-image: none !important; color: var(--bm-ink); }
body { font-family: var(--bm-font) !important; font-size: 14px; font-weight: 500; margin: 0; }
a { color: var(--bm-blue); }
a:hover { color: var(--bm-red); }

/* ---------- Каркас: лише ліве меню */
.bm-nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.bm-sidebar {
    position: fixed; inset: 0 auto 0 0; width: 252px; z-index: 40; background: #FFFFFF;
    border-right: 1px solid var(--bm-line); display: flex; flex-direction: column; overflow-y: auto;
    padding: 20px 14px 16px;
}
.bm-logo { display: block; padding: 2px 8px 0; }
.bm-logo img { width: 150px; height: auto; display: block; }
.bm-product { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--bm-muted); padding: 10px 10px 14px; border-bottom: 1px solid var(--bm-line); margin-bottom: 10px; }
.bm-nav { display: grid; gap: 14px; }
.bm-nav-group { display: grid; gap: 2px; }
.bm-nav-title { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--bm-muted); padding: 4px 10px; }
.bm-nav-link { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: var(--bm-ink) !important; text-decoration: none !important; font-weight: 600; font-size: 13.5px; }
.bm-nav-link i { width: 18px; text-align: center; color: var(--bm-blue); opacity: .75; }
.bm-nav-link:hover { background: var(--bm-panel); }
.bm-nav-link.is-active { background: var(--bm-blue); color: #FFFFFF !important; }
.bm-nav-link.is-active i { color: #FFFFFF; opacity: 1; }
.bm-sidebar-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--bm-line); font-size: 12px; color: var(--bm-muted); display: flex; justify-content: space-between; gap: 8px; }
.bm-muted { color: var(--bm-muted); }
.bm-main { margin-left: 252px; min-height: 100vh; padding: 26px 32px 60px; box-sizing: border-box; }
.bm-main .content { display: block !important; opacity: 1 !important; transform: none !important; position: static !important; }
.bm-burger, .bm-scrim { display: none; }
@media (max-width: 991px) {
    .bm-sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(26,37,64,.18); }
    .bm-nav-toggle:checked ~ .bm-sidebar { transform: none; }
    .bm-nav-toggle:checked ~ .bm-scrim { display: block; position: fixed; inset: 0; background: rgba(26,37,64,.35); z-index: 35; }
    .bm-burger { display: flex; position: fixed; top: 12px; left: 12px; z-index: 30; width: 42px; height: 42px; border-radius: 10px; align-items: center; justify-content: center; background: var(--bm-blue); color: #FFFFFF; cursor: pointer; }
    .bm-main { margin-left: 0; padding: 66px 16px 40px; }
}

/* ---------- Прибрати залишки шаблону */
.header-area, .footer-area, .sidebar-nav, #loader-page, .loader-wrapper { display: none !important; }
.screen { padding: 0 !important; background: transparent !important; }

/* ---------- Типографіка екранів */
.screen h1, .screen .aggregate_title h1, .bm-main h1 {
    font-family: var(--bm-font) !important; font-size: 26px !important; font-weight: 800 !important; letter-spacing: -.01em;
    color: var(--bm-ink) !important; background: none !important; -webkit-text-fill-color: currentColor !important;
    text-transform: none !important; margin: 0 0 18px !important; line-height: 1.2 !important;
}
.screen h3, .screen .title { color: var(--bm-ink); font-weight: 800; }
.screen .row { margin-bottom: 14px; }
section.aggregate { background: transparent !important; box-shadow: none !important; }

/* ---------- Таблиці */
.table-responsive { border: 1px solid var(--bm-line); border-radius: 12px; background: #FFFFFF; }
.table { margin-bottom: 0 !important; font-size: 13px; color: var(--bm-ink); }
.table-bordered, .table-bordered td, .table-bordered th { border-color: var(--bm-line) !important; border-left: 0 !important; border-right: 0 !important; }
.table thead th, .grid-header-row th { background: var(--bm-panel) !important; color: var(--bm-muted) !important; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; border-bottom: 1px solid var(--bm-line) !important; white-space: nowrap; }
.table thead th a { color: var(--bm-muted) !important; }
.table-striped tbody tr:nth-of-type(odd) { background: #FBFCFE !important; }
.table-hover tbody tr:hover { background: var(--bm-blue-soft) !important; }
.table td { vertical-align: middle; }
.table .filters input, .table .filters select, .table .form-control { border: 1px solid var(--bm-line) !important; border-radius: 8px !important; background: #FFFFFF !important; height: 32px; font-size: 12.5px; box-shadow: none !important; }
.summary { font-size: 12px; color: var(--bm-muted); padding: 10px 14px; }
.pagination { padding: 10px 14px; gap: 4px; }
.pagination li a, .pagination li span { border-radius: 8px !important; border: 1px solid var(--bm-line) !important; color: var(--bm-blue) !important; padding: 4px 10px; }
.pagination li.active a, .pagination li.active span { background: var(--bm-blue) !important; color: #FFFFFF !important; border-color: var(--bm-blue) !important; }

/* ---------- Форми і кнопки */
.screen form, .aggregate_form { background: var(--bm-panel); border: 1px solid var(--bm-line); border-radius: 12px; padding: 16px; }
.screen label, .control-label { font-size: 12px; font-weight: 700; color: var(--bm-muted); }
.screen .form-control, .screen select, .screen textarea { border: 1px solid var(--bm-line) !important; border-radius: 8px !important; background: #FFFFFF !important; box-shadow: none !important; }
.btn, .screen button[type=submit], .screen input[type=submit] { border-radius: 8px !important; font-weight: 700 !important; }
.btn-primary, .screen button[type=submit], .screen input[type=submit] { background: var(--bm-red) !important; border-color: var(--bm-red) !important; color: #FFFFFF !important; background-image: none !important; }
.btn-primary:hover { background: #A8000F !important; }

/* ---------- Спільні елементи звітів і компонентів */
.bm-card { background: #FFFFFF; border: 1px solid var(--bm-line); border-radius: 14px; padding: 18px 20px; }
.bm-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.bm-kpi { background: #FFFFFF; border: 1px solid var(--bm-line); border-radius: 12px; padding: 14px 16px; }
.bm-kpi-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--bm-muted); }
.bm-kpi-value { font-family: var(--bm-mono); font-size: 22px; font-weight: 600; margin-top: 6px; font-variant-numeric: tabular-nums; color: var(--bm-ink); }
.bm-kpi-sub { font-size: 12px; color: var(--bm-muted); margin-top: 2px; }
.bm-kpi.is-red .bm-kpi-value { color: var(--bm-red); }
.bm-kpi.is-blue .bm-kpi-value { color: var(--bm-blue); }
.bm-kpi.is-green .bm-kpi-value { color: var(--bm-green); }
.bm-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; margin-bottom: 18px; }
.bm-h2 { font-size: 16px; font-weight: 800; margin: 0 0 12px; color: var(--bm-ink); }
.bm-sub { font-size: 12.5px; color: var(--bm-muted); margin: -8px 0 12px; }
.bm-table-wrap { overflow-x: auto; border: 1px solid var(--bm-line); border-radius: 12px; background: #FFFFFF; }
table.bm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bm-table th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--bm-muted); background: var(--bm-panel); padding: 10px 12px; border-bottom: 1px solid var(--bm-line); white-space: nowrap; }
.bm-table td { padding: 9px 12px; border-bottom: 1px solid var(--bm-line); white-space: nowrap; }
.bm-table tr:last-child td { border-bottom: 0; }
.bm-table td.num, .bm-table th.num { text-align: right; font-family: var(--bm-mono); font-variant-numeric: tabular-nums; }
.bm-table tr.is-total td { font-weight: 800; background: var(--bm-blue-soft); }
.bm-table tr.is-sub td { font-weight: 700; background: #FBFCFE; }
.bm-table td.neg { color: var(--bm-red); }
.bm-table td.pos { color: var(--bm-green); }
.bm-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--bm-panel); color: var(--bm-ink); white-space: nowrap; }
.bm-chip i.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.bm-avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--bm-blue); color: #FFFFFF; font-size: 10px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.bm-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 18px; }
.bm-filters label { display: grid; gap: 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--bm-muted); }
.bm-filters select { height: 36px; border: 1px solid var(--bm-line); border-radius: 8px; padding: 0 10px; font: 600 13px var(--bm-font); color: var(--bm-ink); background: #FFFFFF; min-width: 180px; }
.bm-chart { position: relative; height: 300px; }
.bm-note { font-size: 12.5px; color: var(--bm-muted); border-left: 3px solid var(--bm-blue); padding: 6px 0 6px 12px; margin: 6px 0 16px; }
.bm-empty { padding: 40px; text-align: center; color: var(--bm-muted); }

/* ---------- Вкладки екрана */
.bm-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--bm-line); margin: 4px 0 20px; }
.bm-tab { padding: 10px 16px; font-weight: 700; font-size: 13.5px; color: var(--bm-muted) !important; text-decoration: none !important; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.bm-tab:hover { color: var(--bm-blue) !important; }
.bm-tab.is-active { color: var(--bm-ink) !important; border-bottom-color: var(--bm-red); }

/* ---------- Відступ шаблону під колишню шапку не потрібен */
.bm-main .content-wrapper { padding-top: 0 !important; margin-top: 0 !important; }

/* ---------- Ризик клієнтів (зустріч 07.10) */
.bm-risk-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.bm-risk-col { background: var(--bm-panel); border: 1px solid var(--bm-line); border-top: 4px solid var(--zone); border-radius: 12px; padding: 12px; display: grid; gap: 10px; align-content: start; }
.bm-risk-col.is-red { --zone: var(--bm-red); } .bm-risk-col.is-amber { --zone: #E0A100; } .bm-risk-col.is-green { --zone: var(--bm-green); }
.bm-risk-col header { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.bm-risk-col header span { font-family: var(--bm-mono); background: var(--zone); color: #FFFFFF; border-radius: 999px; padding: 1px 9px; font-size: 12px; }
.bm-risk-rule { font-size: 12px; color: var(--bm-muted); margin-top: -6px; }
.bm-risk-card { display: grid; gap: 6px; background: #FFFFFF; border: 1px solid var(--bm-line); border-radius: 10px; padding: 10px 12px; color: var(--bm-ink) !important; text-decoration: none !important; }
.bm-risk-card:hover { border-color: var(--zone); }
.bm-risk-name { font-weight: 800; font-size: 13.5px; }
.bm-risk-meta { font-size: 11.5px; color: var(--bm-muted); }
.bm-risk-card dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0; font-size: 12.5px; }
.bm-risk-card dt { color: var(--bm-muted); font-weight: 600; }
.bm-risk-card dd { margin: 0; text-align: right; font-family: var(--bm-mono); font-variant-numeric: tabular-nums; }
.bm-risk-card .up { color: var(--bm-red); } .bm-risk-card .down { color: var(--bm-green); }
.bm-risk-rec { font-size: 12px; border-top: 1px dashed var(--bm-line); padding-top: 6px; color: var(--bm-ink); }
.bm-risk-more { font-size: 12.5px; font-weight: 700; text-align: center; }
.bm-zone { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 800; color: #FFFFFF; }
.bm-zone.is-red { background: var(--bm-red); } .bm-zone.is-amber { background: #E0A100; } .bm-zone.is-green { background: var(--bm-green); }

/* ---------- Адаптація менеджерів */
.bm-person { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.bm-progress { width: 160px; height: 8px; background: var(--bm-line); border-radius: 999px; overflow: hidden; margin-bottom: 4px; }
.bm-progress i { display: block; height: 100%; background: var(--bm-blue); }
.bm-progress.is-done i { background: var(--bm-green); }
.bm-program { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bm-program li { display: grid; grid-template-columns: 62px 1fr auto; gap: 10px; align-items: start; padding-bottom: 10px; border-bottom: 1px solid var(--bm-line); }
.bm-program li:last-child { border-bottom: 0; }
.bm-program .bm-day { font-family: var(--bm-mono); font-size: 12px; color: var(--bm-red); font-weight: 600; padding-top: 2px; }
.bm-program b i { color: var(--bm-blue); width: 16px; }
.bm-program .bm-muted { font-size: 12.5px; margin-top: 2px; white-space: normal; }
.bm-ls-risk { display: grid; gap: 4px; margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--bm-line); border-left: 4px solid var(--zone, var(--bm-line)); color: var(--bm-ink) !important; text-decoration: none !important; font-size: 12.5px; }
.bm-ls-risk.is-red { --zone: var(--bm-red); } .bm-ls-risk.is-amber { --zone: #E0A100; } .bm-ls-risk.is-green { --zone: var(--bm-green); }
.bm-ls-risk .bm-zone { justify-self: start; }
.bm-ls-risk small { color: var(--bm-muted); font-size: 12px; }

/* ---------- Залишки і резерви (матеріали 12.10) */
.bm-avail th.grp { text-align: center; border-left: 1px solid var(--bm-line); }
.bm-avail td.num:nth-child(3n+2) { border-left: 1px solid var(--bm-line); }
.bm-filters .bm-check { flex-direction: row; display: flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; font-size: 13px; height: 36px; }

/* ---------- Вхідні звернення, банк, калькулятор (зустріч 12.10) */
.bm-inbox { display: grid; gap: 10px; }
.bm-msg { display: grid; grid-template-columns: 42px 1fr; gap: 12px; background: #FFFFFF; border: 1px solid var(--bm-line); border-left: 4px solid var(--zone, var(--bm-line)); border-radius: 12px; padding: 12px 14px; }
.bm-msg.is-red { --zone: var(--bm-red); } .bm-msg.is-amber { --zone: #E0A100; } .bm-msg.is-green { --zone: var(--bm-green); }
.bm-msg-ch { width: 42px; height: 42px; border-radius: 10px; background: var(--bm-blue-soft); color: var(--bm-blue); display: flex; align-items: center; justify-content: center; font-size: 18px; }
.bm-msg-body { display: grid; gap: 6px; min-width: 0; }
.bm-msg-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; font-size: 13.5px; }
.bm-msg-time { margin-left: auto; font-size: 12px; color: var(--bm-muted); }
.bm-msg-text { font-size: 13.5px; }
.bm-msg-foot { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font-size: 12.5px; }
.bm-btn-fake { display: inline-block; background: var(--bm-red); color: #FFFFFF; border-radius: 8px; padding: 4px 12px; font-weight: 700; font-size: 12px; }
.bm-table td.bm-wrap { white-space: normal; min-width: 240px; }
select.bm-inline { height: 30px; border: 1px solid var(--bm-red); border-radius: 8px; font: 600 12px var(--bm-font); padding: 0 6px; background: #FFFFFF; }
.bm-frame-wrap { border: 1px solid var(--bm-line); border-radius: 14px; overflow: hidden; background: #FFFFFF; }
.bm-frame-wrap iframe { display: block; width: 100%; height: 82vh; min-height: 640px; border: 0; }

/* ---------- Найм і звіти (рішення 13.10: повна ERP) */
.bm-kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.bm-kanban .bm-col { background: #F4F6FA; border-radius: 12px; padding: 10px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.bm-kanban .bm-col.is-muted { opacity: .7; }
.bm-kanban .bm-col header { display: flex; justify-content: space-between; align-items: center; font-size: 13px; padding: 2px 4px 6px; }
.bm-kanban .bm-col header span { background: #FFFFFF; border-radius: 10px; padding: 0 8px; font-weight: 700; color: var(--bm-muted); }
.bm-kanban .bm-card { padding: 10px 12px; border-radius: 10px; display: grid; gap: 4px; font-size: 12.5px; }
.bm-kanban .bm-card-title { font-weight: 700; font-size: 13.5px; }
.bm-kanban .bm-card-foot { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.bm-table td a.neg { color: var(--bm-red); }

/* P&L, рух коштів, баланс за шаблонами фінвідділу (23.10) */
.bm-seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--bm-line); border-radius: 10px; overflow: hidden; background: #FFFFFF; }
.bm-seg a { padding: 7px 12px; font-size: 12.5px; font-weight: 700; color: var(--bm-ink); text-decoration: none; border-right: 1px solid var(--bm-line); }
.bm-seg a:last-child { border-right: 0; }
.bm-seg a.is-active { background: var(--bm-blue); color: #FFFFFF; }
.bm-table td.bm-code { font-family: var(--bm-mono); font-size: 11.5px; color: var(--bm-muted); }
.bm-table tr.is-margin td { font-weight: 800; background: #FFF4E0; }
.bm-table tr.bm-muted td { color: var(--bm-muted); font-size: 12px; }
.bm-pnl td:nth-child(2) { white-space: normal; min-width: 260px; }
.bm-balance-row { display: grid; grid-template-columns: 80px 1fr; gap: 12px; align-items: center; margin-bottom: 10px; }
.bm-balance-label { font-weight: 800; font-size: 13px; }
.bm-balance-bar { display: flex; height: 44px; border-radius: 10px; overflow: hidden; background: var(--bm-panel); }
.bm-balance-bar span { display: flex; align-items: center; justify-content: center; color: #FFFFFF; font-family: var(--bm-mono); font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; border-right: 2px solid #FFFFFF; }

/* ---------- Калькулятор фасадів (файл «Фасадні рішення», 27.10) */
.bm-fc-flash { border-radius: 10px; padding: 10px 14px; margin: 0 0 14px; font-weight: 700; }
.bm-fc-flash.is-ok { background: #E8F5EE; color: var(--bm-green); }
.bm-fc-flash.is-err { background: var(--bm-red-soft); color: var(--bm-red); }
.bm-fc-form .bm-filters { margin-bottom: 10px; }
.bm-fc-in { box-sizing: border-box; height: 36px; width: 120px; border: 1px solid var(--bm-line); border-radius: 8px; padding: 0 10px !important; margin: 0; font: 600 13px var(--bm-font); color: var(--bm-ink); background: #FFFFFF; }
.bm-fc-linear .bm-fc-in { width: 104px; }
.bm-fc-btn { height: 36px; border: 1px solid var(--bm-blue); border-radius: 8px; padding: 0 14px; font: 700 13px var(--bm-font); background: var(--bm-blue); color: #FFFFFF; cursor: pointer; }
.bm-fc-btn:hover { background: var(--bm-blue-2); }
.bm-fc-btn.is-ghost { background: #FFFFFF; color: var(--bm-blue); }
.bm-fc-btn:disabled { opacity: .45; cursor: default; }
.bm-fc-systems { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 6px 0 18px; }
.bm-fc-sys { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--bm-line); border-radius: 12px; background: #FFFFFF; color: var(--bm-ink) !important; text-decoration: none !important; }
.bm-fc-sys:hover { border-color: var(--bm-blue-2); }
.bm-fc-sys.is-active { border-color: var(--bm-red); box-shadow: inset 0 0 0 1px var(--bm-red); }
.bm-fc-class { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--bm-muted); }
.bm-fc-sum { font-family: var(--bm-mono); font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bm-fc-meta { font-size: 12px; color: var(--bm-muted); }
.is-warn { color: var(--bm-amber); }
.bm-fc-table td { vertical-align: top; }
.bm-fc-table tr.is-zero td { color: var(--bm-muted); }
.bm-fc-layer { font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--bm-muted); }
.bm-fc-disc { box-sizing: border-box; width: 68px; height: 30px; border: 1px solid var(--bm-line); border-radius: 6px; padding: 0 6px !important; margin: 0; text-align: right; font: 600 13px var(--bm-mono); }
.bm-fc-disc.is-over { border-color: var(--bm-red); color: var(--bm-red); }
.bm-fc-hint { font-size: 11px; color: var(--bm-muted); font-family: var(--bm-font); }
.bm-fc-after { margin: 10px 0 12px; }
.bm-fc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.bm-fc-doc { border: 1px solid var(--bm-line); border-radius: 14px; padding: 22px 24px; background: #FFFFFF; display: grid; gap: 16px; max-width: 1180px; }
.bm-fc-doc-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding: 16px 18px; border-radius: 10px; background: var(--bm-blue); color: #FFFFFF; }
.bm-fc-doc-title { font-size: 24px; font-weight: 800; letter-spacing: .01em; }
.bm-fc-doc-meta { font-size: 13px; text-align: right; }
.bm-fc-doc-greet { margin: 0; font-size: 14px; }
.bm-fc-desc { font-size: 12px; color: var(--bm-muted); font-weight: 500; white-space: normal; max-width: 520px; margin-top: 4px; }
.bm-fc-proj { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.bm-fc-proj > div { display: grid; gap: 4px; }
.bm-fc-proj img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; }
.bm-fc-dir { margin-bottom: 18px; }
.bm-fc-ok { color: var(--bm-green); font-weight: 700; }
.bm-fc-notes ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
@media (max-width: 640px) { .bm-fc-in, .bm-fc-linear .bm-fc-in { width: 100%; } .bm-fc-doc { padding: 14px; } .bm-fc-doc-meta { text-align: left; } }

/* ---------- Робочі місця: розділ зліва, вкладки зверху (31.10) */
.bm-nav-map { display: flex; align-items: center; gap: 11px; margin-top: 6px; padding: 9px 10px; border-radius: 8px; border: 1px dashed var(--bm-line); color: var(--bm-blue) !important; text-decoration: none !important; font-weight: 700; font-size: 13px; }
.bm-nav-map:hover { border-color: var(--bm-blue); background: var(--bm-blue-soft); }
.bm-nav-map i { width: 18px; text-align: center; }
.bm-ws-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; border-bottom: 1px solid var(--bm-line); margin: -6px 0 22px; }
.bm-ws-name { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--bm-muted); margin-right: 12px; padding: 10px 0; }
.bm-ws-tab { padding: 10px 14px; font-weight: 700; font-size: 13.5px; color: var(--bm-muted) !important; text-decoration: none !important; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.bm-ws-tab:hover { color: var(--bm-blue) !important; }
.bm-ws-tab.is-active { color: var(--bm-ink) !important; border-bottom-color: var(--bm-red); }
@media (max-width: 991px) { .bm-ws-tabs { flex-wrap: nowrap; overflow-x: auto; } .bm-ws-name { display: none; } }

/* ---------- Спільне для нових екранів */
.bm-crumbs { font-size: 12.5px; color: var(--bm-muted); margin-bottom: 6px; }
.bm-small { font-size: 11.5px; }
.bm-mono { font-family: var(--bm-mono); font-size: 12px; }
.bm-h3 { font-size: 13px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; color: var(--bm-muted); margin: 18px 0 8px; }
.bm-chip.is-green { background: #E8F5EE; color: var(--bm-green); }
.bm-chip.is-red { background: var(--bm-red-soft); color: var(--bm-red); }
.bm-chip.is-blue { background: var(--bm-blue-soft); color: var(--bm-blue); }
.bm-chip.is-amber { background: #FFF4E0; color: var(--bm-amber); }
.neg { color: var(--bm-red); } .pos { color: var(--bm-green); }
.bm-card.is-alert { border-color: var(--bm-red); box-shadow: inset 4px 0 0 var(--bm-red); }
.bm-dl { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; margin: 8px 0 12px; font-size: 13px; }
.bm-dl dt { color: var(--bm-muted); font-weight: 600; }
.bm-dl dd { margin: 0; text-align: right; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Картка угоди */
.bm-deal-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.bm-deal-title { min-width: 0; flex: 1 1 520px; }
.bm-deal-title h1 { margin: 0 0 4px !important; }
.bm-deal-title p { margin: 0 0 10px; color: var(--bm-ink); font-size: 15px; }
.bm-deal-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bm-deal-chips .bm-avatar { width: 18px; height: 18px; font-size: 8px; }
.bm-deal-sum { text-align: right; }
.bm-deal-money { font-family: var(--bm-mono); font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bm-stepper { list-style: none; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(110px, 1fr); gap: 4px; padding: 0; margin: 0 0 18px; overflow-x: auto; }
.bm-stepper li { position: relative; background: var(--bm-panel); border: 1px solid var(--bm-line); border-radius: 8px; padding: 8px 10px; display: grid; gap: 2px; }
.bm-stepper li span { font-size: 12.5px; font-weight: 700; }
.bm-stepper li small { font-size: 11px; color: var(--bm-muted); }
.bm-stepper li.is-done { background: var(--bm-blue-soft); border-color: #C9D6F2; }
.bm-stepper li.is-current { background: var(--bm-blue); border-color: var(--bm-blue); color: #FFFFFF; }
.bm-stepper li.is-current small { color: #DCE4F7; }
.bm-stepper li.is-lost { background: var(--bm-red); border-color: var(--bm-red); color: #FFFFFF; }
.bm-deal-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.bm-deal-main, .bm-deal-side { display: grid; gap: 16px; min-width: 0; }
@media (max-width: 1200px) { .bm-deal-grid { grid-template-columns: 1fr; } }
.bm-chain { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 6px; }
.bm-chain li { border: 1px solid var(--bm-line); border-top: 4px solid var(--bm-line); border-radius: 8px; padding: 8px 10px; display: grid; gap: 2px; font-size: 12px; min-width: 0; }
.bm-chain li b { font-size: 12.5px; }
.bm-chain li span { overflow-wrap: anywhere; }
.bm-chain li small { color: var(--bm-muted); }
.bm-chain li.is-done { border-top-color: var(--bm-green); }
.bm-chain li.is-wait { border-top-color: #E0A100; background: #FFFBF2; }
.bm-chain li.is-bad { border-top-color: var(--bm-red); }
.bm-chain li.is-none { color: var(--bm-muted); border-style: dashed; border-top-style: solid; }
.bm-deal-margin { margin-top: 12px; padding: 10px 14px; border-radius: 10px; font-size: 13px; }
.bm-deal-margin.is-ok { background: #E8F5EE; }
.bm-deal-margin.is-warn { background: #FFF4E0; }
.bm-doc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.bm-doc { display: grid; grid-template-columns: 32px 1fr; gap: 10px; border: 1px solid var(--bm-line); border-radius: 10px; padding: 10px 12px; }
.bm-doc > i { width: 32px; height: 32px; border-radius: 8px; background: var(--bm-blue-soft); color: var(--bm-blue); display: flex; align-items: center; justify-content: center; }
.bm-doc div { display: grid; gap: 2px; font-size: 12.5px; min-width: 0; }
.bm-doc small { color: var(--bm-muted); }
.bm-ledger { display: grid; gap: 10px; }
.bm-ledger-tx { border: 1px solid var(--bm-line); border-radius: 10px; overflow: hidden; }
.bm-ledger-head { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding: 8px 12px; background: var(--bm-panel); border-bottom: 1px solid var(--bm-line); font-size: 12.5px; }
.bm-ledger-tx .bm-table td { padding: 6px 12px; }
.bm-ledger-tx .bm-table td.bm-wrap { min-width: 0; }
.bm-next { font-size: 15px; font-weight: 700; margin: 6px 0 4px; }
.bm-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.bm-actions .bm-btn-fake { cursor: not-allowed; }
.bm-side-title { font-size: 17px; font-weight: 800; margin: 4px 0 0; }
.bm-deal-side details summary { cursor: pointer; font-weight: 700; color: var(--bm-blue); font-size: 13px; }
.bm-deal-side p { font-size: 13px; }
.bm-timeline { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 10px; }
.bm-timeline li { display: grid; grid-template-columns: 26px 1fr; gap: 8px; font-size: 12.5px; }
.bm-timeline li > i { width: 26px; height: 26px; border-radius: 50%; background: var(--bm-panel); color: var(--bm-blue); display: flex; align-items: center; justify-content: center; font-size: 11px; }
.bm-timeline li.is-stage > i { color: var(--bm-muted); }
.bm-timeline li div { display: grid; gap: 1px; min-width: 0; }
.bm-timeline li span { overflow-wrap: anywhere; }
.bm-timeline li small { color: var(--bm-muted); }
.bm-deal-main > *, .bm-deal-side > * { min-width: 0; }

/* ---------- Як працює система */
.bm-start-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.bm-start-head h1 { margin-bottom: 6px !important; }
.bm-start-lead { max-width: 760px; font-size: 15px; color: var(--bm-muted); margin: 0; }
.bm-start-map { display: inline-flex; align-items: center; gap: 8px; text-decoration: none !important; color: #FFFFFF !important; }
a.bm-kpi { text-decoration: none !important; color: inherit !important; }
a.bm-kpi:hover { border-color: var(--bm-blue-2); }
.bm-steps { list-style: none; padding: 0; margin: 0 0 28px; display: grid; gap: 0; position: relative; }
.bm-step { display: grid; grid-template-columns: 40px 1fr; gap: 14px; position: relative; padding-bottom: 14px; }
.bm-step::before { content: ""; position: absolute; left: 19px; top: 40px; bottom: 0; width: 2px; background: var(--bm-line); }
.bm-step:last-child::before { display: none; }
.bm-step-n { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-family: var(--bm-mono); background: var(--bm-blue); color: #FFFFFF; z-index: 1; }
.bm-step.is-ext .bm-step-n { background: #66708A; }
.bm-step.is-erp .bm-step-n { background: var(--bm-blue-2); }
.bm-step.is-config .bm-step-n { background: var(--bm-amber); }
.bm-step-body { background: #FFFFFF; border: 1px solid var(--bm-line); border-radius: 12px; padding: 12px 16px; min-width: 0; }
.bm-step-body h3 { font-size: 15.5px; font-weight: 800; margin: 2px 0 4px; }
.bm-step-body p { margin: 0 0 8px; font-size: 13.5px; max-width: 900px; }
.bm-step-lane { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--bm-muted); }
.bm-step-links { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.bm-step-screen { font-weight: 700; font-size: 13px; text-decoration: none !important; }
.bm-step-ex { font-size: 13px; color: var(--bm-red) !important; font-weight: 700; text-decoration: none !important; }
.bm-start-h2 { font-size: 19px; margin-top: 8px; }
.bm-zones { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.bm-zone-card { border: 1px solid var(--bm-line); border-top: 4px solid var(--bm-blue); border-radius: 12px; padding: 14px 16px; background: #FFFFFF; display: grid; gap: 8px; align-content: start; }
.bm-zone-card.is-config { border-top-color: var(--bm-amber); }
.bm-zone-card.is-code { border-top-color: var(--bm-blue); }
.bm-zone-card.is-data { border-top-color: var(--bm-red); }
.bm-zone-card ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 13px; }
.bm-zone-card p { margin: 0; font-size: 13px; }

/* ---------- Документ і проводки */
.bm-trace { margin-bottom: 16px; }
.bm-trace-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.bm-trace-checks { display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; max-width: 620px; justify-content: flex-end; }
.bm-trace-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.bm-trace-grid > div { min-width: 0; }
@media (max-width: 1100px) { .bm-trace-grid { grid-template-columns: 1fr; } }
.bm-dim { font-size: 11px; font-weight: 600; margin: 1px 0; }

/* ---------- Налаштування */
.bm-set-toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.bm-set-toc a { border: 1px solid var(--bm-line); border-radius: 999px; padding: 4px 12px; font-size: 12.5px; font-weight: 700; text-decoration: none !important; color: var(--bm-ink) !important; background: #FFFFFF; }
.bm-set-toc a:hover { border-color: var(--bm-blue); }
.bm-set { margin-bottom: 16px; scroll-margin-top: 16px; }
.bm-set > header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; align-items: flex-start; }
.bm-set > header > div { min-width: 0; flex: 1 1 520px; }
.bm-set .bm-sub { margin: -6px 0 10px; max-width: 900px; }
.bm-set-edit { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--bm-blue); border-radius: 8px; padding: 6px 12px; font-size: 12.5px; font-weight: 700; text-decoration: none !important; white-space: nowrap; }
.bm-set-edit:hover { background: var(--bm-blue); color: #FFFFFF !important; }
.bm-set-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.bm-set-pills a.bm-chip { text-decoration: none !important; }
.bm-set details { margin-top: 8px; }
.bm-set details > summary { cursor: pointer; font-weight: 700; color: var(--bm-blue); font-size: 13px; margin-bottom: 8px; }
.bm-set-cols { columns: 3 260px; column-gap: 24px; font-size: 12.5px; }
.bm-set-cols div { break-inside: avoid; padding: 2px 0; }
.bm-rules { display: grid; gap: 6px; }
.bm-rule { border: 1px solid var(--bm-line); border-radius: 10px; padding: 8px 12px; margin: 0 !important; }
.bm-rule > summary { color: var(--bm-ink) !important; font-weight: 500 !important; margin: 0 !important; font-size: 13px; }
.bm-rule[open] > summary { margin-bottom: 8px !important; }
.bm-set.is-proposal { border-style: dashed; border-color: var(--bm-amber); }
.bm-data-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.bm-data-group { background: #FFFFFF; border: 1px solid var(--bm-line); border-radius: 12px; padding: 12px 14px; }
.bm-data-group h2 { font-size: 14px; font-weight: 800; margin: 0 0 8px; }
.bm-data-group ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.bm-data-group li a { display: flex; justify-content: space-between; gap: 8px; padding: 5px 8px; border-radius: 6px; text-decoration: none !important; color: var(--bm-ink) !important; font-size: 13px; }
.bm-data-group li a:hover { background: var(--bm-blue-soft); }
.bm-data-group li a span { color: var(--bm-muted); font-family: var(--bm-mono); font-size: 12px; }
.bm-data-group li a code { color: var(--bm-muted); font-size: 11px; background: none; }

/* ---------- Дошка доставок */
.bm-logi { grid-auto-columns: minmax(240px, 1fr); }
.bm-logi .bm-col.is-plan { background: #FFF6E6; }
.bm-logi a.bm-card { text-decoration: none !important; color: var(--bm-ink) !important; }
.bm-logi a.bm-card:hover { border-color: var(--bm-blue-2); }
@media (max-width: 640px) { .bm-chip { white-space: normal; } .bm-deal-sum { text-align: left; } .bm-trace-checks { justify-content: flex-start; } }
.bm-grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); } .bm-grid-2 > * { min-width: 0; }

/* ---------- Універсальний CRUD таблиць */
.bm-crud-form { background: #FFFFFF !important; }
.bm-crud-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px 16px; margin-bottom: 16px; }
.bm-crud-grid label { display: grid; gap: 4px; font-size: 12px; font-weight: 700; color: var(--bm-muted); min-width: 0; }
.bm-crud-grid label.is-wide { grid-column: 1 / -1; }
.bm-crud-grid label code { font-weight: 500; font-size: 10.5px; background: none; color: var(--bm-muted); }
.bm-crud-grid input[type=text], .bm-crud-grid input[type=number], .bm-crud-grid input[type=date], .bm-crud-grid input[type=datetime-local], .bm-crud-grid select, .bm-crud-grid textarea {
    box-sizing: border-box; width: 100%; min-height: 36px; border: 1px solid var(--bm-line); border-radius: 8px; padding: 6px 10px; font: 600 13px var(--bm-font); color: var(--bm-ink); background: #FFFFFF; }
.bm-crud-grid input[type=checkbox] { width: 20px; height: 20px; }
.bm-danger { color: var(--bm-red) !important; border-color: var(--bm-red) !important; }
.bm-crud td { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.bm-amounts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 10px 18px; }
.bm-amount-group .bm-h3 { margin-top: 4px; }
.bm-amount-group ul { margin: 0; padding-left: 16px; display: grid; gap: 3px; font-size: 12.5px; }
.bm-amount-group code { background: none; color: var(--bm-muted); font-size: 10.5px; }

/* ---------- Контури проведення документа */
.bm-contour { margin-bottom: 16px; border-top: 4px solid var(--bm-blue); }
.bm-contour-form { background: transparent !important; border: 0 !important; padding: 0 !important; margin: 4px 0 12px; display: grid; gap: 10px; }
.bm-contour-flags { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; }
.bm-switch { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--bm-line); border-radius: 10px; padding: 10px 14px; cursor: pointer; background: var(--bm-panel); text-transform: none !important; letter-spacing: 0 !important; color: var(--bm-ink) !important; font-size: 13px !important; }
.bm-switch input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--bm-blue); }
.bm-switch span { display: grid; gap: 1px; }
.bm-switch small { color: var(--bm-muted); font-weight: 500; font-size: 11.5px; }
.bm-contour-presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.bm-preset { border: 1px solid var(--bm-line) !important; background: #FFFFFF !important; color: var(--bm-ink) !important; border-radius: 999px !important; padding: 5px 12px; font: 700 12.5px var(--bm-font); cursor: pointer; }
.bm-preset.is-active { background: var(--bm-blue) !important; color: #FFFFFF !important; border-color: var(--bm-blue) !important; }
.bm-contour-effects { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 8px; margin-bottom: 12px; }
.bm-contour-effects > div { border-radius: 10px; padding: 10px 12px; font-size: 12.5px; display: grid; gap: 4px; }
.bm-contour-effects .is-on { background: #E8F5EE; }
.bm-contour-effects .is-off { background: #F1F3F7; color: var(--bm-muted); }
.screen button.bm-preset[type=submit] { background: #FFFFFF !important; color: var(--bm-ink) !important; border: 1px solid var(--bm-line) !important; border-radius: 999px !important; font-weight: 700 !important; }
.screen button.bm-preset.is-active[type=submit] { background: var(--bm-blue) !important; color: #FFFFFF !important; border-color: var(--bm-blue) !important; }

/* ---------- Діаграма Ґантта проєктів */
.bm-gantt { margin-bottom: 16px; }
.bm-gantt-scale, .bm-gantt-row { display: grid; grid-template-columns: minmax(180px, 32%) 1fr; gap: 10px; align-items: center; }
.bm-gantt-scale > div, .bm-gantt-row > div { position: relative; height: 22px; background: repeating-linear-gradient(90deg, transparent 0 calc(100% / 8 - 1px), var(--bm-line) calc(100% / 8 - 1px) calc(100% / 8)); border-radius: 6px; }
.bm-gantt-scale > div { background: none; height: 18px; }
.bm-gantt-scale i { position: absolute; top: 0; font-style: normal; font-size: 10.5px; color: var(--bm-muted); }
.bm-gantt-row { padding: 6px 0; border-top: 1px solid var(--bm-line); font-size: 12.5px; }
.bm-gantt-row small { display: block; color: var(--bm-muted); }
.bm-gantt-bar { position: absolute; top: 3px; height: 16px; border-radius: 5px; background: #9DB4D8; }
.bm-gantt-bar.is-work { background: var(--bm-blue); }
.bm-gantt-bar.is-done { background: #3F9B5B; }
@media (max-width: 640px) { .bm-gantt-scale, .bm-gantt-row { grid-template-columns: 1fr; } .bm-gantt-scale > span { display: none; } }
.bm-gantt h2 { font-size: 18px; }

/* ---------- Розшифровка цифри: цифра у звіті веде на деталі */
a.bm-drill-num { color: inherit; text-decoration: underline dotted rgba(26, 62, 140, .45); text-underline-offset: 3px; }
a.bm-drill-num:hover { color: var(--bm-blue); text-decoration-style: solid; background: #EEF3FC; border-radius: 4px; }
.bm-drill-cuts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 12px; margin-bottom: 16px; align-items: start; }
.bm-drill-cuts .bm-card { margin: 0; }
.bm-set-pills .bm-chip a { margin-left: 4px; text-decoration: none; font-weight: 800; }
.bm-rel { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.bm-drill-cuts .bm-table { width: 100%; }
.bm-drill-cuts .bm-table td { padding: 6px 8px; }
.bm-drill-cuts .bm-card { overflow-x: auto; }
