/* EpicentriK — стилі кабінету (DEV-001 A). Без CDN; Bootstrap/HTMX у static/vendor/ ще не додані. */
:root {
  --nav-bg: #1f2430; --nav-text: #e6e8ee; --nav-muted: #a3a9b8;
  --bg: #f5f6f8; --surface: #fff; --text: #1d2129; --muted: #555d6b; --border: #d9dde4;
  --accent: #c2410c; --accent-hover: #9a3412; --focus: #2563eb;
  --info-bg: #e8f0fe; --error-bg: #fdecea; --error-text: #8a1c12;
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--bg); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--surface); padding: .5rem 1rem; z-index: 10; }
.skip-link:focus { left: 1rem; top: 1rem; }
.layout { display: flex; min-height: 100vh; }
.nav-list { list-style: none; margin: 0; padding: 0; flex: 1; }
.nav-item { display: block; padding: .5rem .75rem; border-radius: 6px; color: var(--nav-text); text-decoration: none; }
a.nav-item:hover { background: #2c3242; }
.nav-item.is-active { background: var(--accent); color: #fff; }
.nav-item.is-disabled { color: var(--nav-muted); cursor: not-allowed; }
.nav-item small { font-size: .75rem; margin-left: .25rem; }
.workspace { flex: 1; min-width: 0; padding: 1.5rem 2rem; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-title { margin: 0; font-size: 1.5rem; }
.user-box { display: flex; align-items: center; gap: .75rem; }
.user-box form { margin: 0; }
.eyebrow { color: var(--muted); margin: 0 0 .5rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 1rem 1.25rem; margin-bottom: 1rem; }
.card h1, .card h2 { margin: 0 0 .5rem; font-size: 1.15rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.badge-unavailable { background: #e5e7eb; color: #374151; border: 1px solid #9ca3af; border-radius: 999px; padding: .1rem .6rem; font-size: .8rem; }
.empty-state p { margin: .25rem 0 0; color: var(--muted); }
.signed-in { color: var(--muted); }
.btn { display: inline-block; font: inherit; padding: .45rem 1rem; border-radius: 6px; border: 1px solid transparent; cursor: pointer; text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.alert { padding: .6rem .9rem; border-radius: 6px; margin-bottom: 1rem; background: var(--info-bg); }
.alert-error { background: var(--error-bg); color: var(--error-text); }
.public-main { max-width: 440px; margin: 4rem auto; padding: 0 1rem; }
.public-brand { display: flex; flex-direction: column; align-items: center; gap: .35rem; color: var(--muted); }
.public-brand img { display: block; }
.field { margin-bottom: 1rem; }
.field label { display: block; margin-bottom: .25rem; font-weight: 600; }
.field input { width: 100%; padding: .5rem; font: inherit; border: 1px solid #8a92a0; border-radius: 6px; }
.field input[aria-invalid="true"] { border-color: var(--error-text); }
.field-error { color: var(--error-text); margin: .25rem 0 0; font-size: .9rem; }
.hint { text-align: center; color: var(--muted); font-size: .9rem; }
@media (max-width: 768px) {
  .workspace { padding: 1rem; }
}
/* DEV-001 B2: доступ, довідник магазинів */
.user-link { color: var(--text); }
.muted { color: var(--muted); }
.lead-note { margin: 0 0 .5rem; }
.hint-left { color: var(--muted); font-size: .9rem; margin: 0 0 1rem; }
.badge { display: inline-block; border: 1px solid #9ca3af; background: #f3f4f6; color: #1f2937; border-radius: 999px; padding: .1rem .6rem; font-size: .8rem; font-weight: 600; }
.badge-global { background: #fff7ed; border-color: var(--accent); color: var(--accent-hover); }
.badge-warn { background: #fef3c7; border-color: #b45309; color: #78350f; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: .5rem 0; }
.kv dt { font-weight: 600; color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.perms-h, .perms summary { font-size: 1rem; font-weight: 600; margin: .75rem 0 .25rem; cursor: pointer; }
.perm-group h4 { margin: .5rem 0 .25rem; font-size: .9rem; color: var(--muted); }
.perm-list { margin: 0; padding-left: 1.25rem; }
.code-sm { font-family: ui-monospace, Menlo, monospace; font-size: .8rem; color: var(--muted); }
.alert-info { background: var(--info-bg); }
.alert-warning { background: #fef3c7; color: #78350f; }
.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin-bottom: 1rem; }
.filter label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .2rem; }
.filter select, .filter input { font: inherit; padding: .4rem; border: 1px solid #8a92a0; border-radius: 6px; background: var(--surface); max-width: 100%; }
.filter-actions { display: flex; gap: .5rem; }
.table-meta { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
/* Базова таблиця: повна ширина, тонкі розділювачі, приглушені заголовки, числа — табличні. */
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th, .table td { padding: .55rem .75rem; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
.table thead th { font-size: .8rem; font-weight: 500; color: var(--muted); background: #f7f8fa; white-space: nowrap; }
.table tbody tr:last-child > * { border-bottom: 0; }
.table tbody th { font-weight: 500; }
.table-sm th, .table-sm td { padding: .4rem .75rem; }
.table-wrap > .table { margin: 0; }
.text-end { text-align: right !important; }
.text-center { text-align: center !important; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 1rem; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { text-align: left; padding: .45rem .75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table th { background: #eef0f4; font-size: .9rem; }
.pagination { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.page-current { font-weight: 700; padding: 0 .4rem; }
.detail-head { margin-bottom: .75rem; }
.history summary { font-weight: 600; cursor: pointer; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 768px) { .filter, .filter-q { flex: 1 1 100%; } .filter select, .filter input { width: 100%; } }
/* DEV-001 B3: журнал дій */
.nowrap { white-space: nowrap; }
.alert-line { margin: 0; }
.code-actor { font-family: ui-monospace, Menlo, monospace; font-size: .9rem; }
.audit-table td, .changes-table td, .changes-table th { overflow-wrap: anywhere; }
.changes-table th[scope="row"] { background: transparent; font-weight: 600; }
.chips { margin: 0 0 1rem; }
.chip { display: inline-flex; gap: .4rem; align-items: center; border: 1px solid var(--accent); background: #fff7ed; color: var(--accent-hover); border-radius: 999px; padding: .15rem .7rem; font-size: .9rem; }
.chip a { color: inherit; text-decoration: none; font-weight: 700; }
.long-value pre { white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, Menlo, monospace; font-size: .85rem; margin: .25rem 0 0; }
.long-value summary { cursor: pointer; }
[hidden] { display: none !important; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: block; }
[aria-busy="true"] { opacity: .6; }
.filter input[aria-invalid="true"], .filter select[aria-invalid="true"] { border-color: var(--error-text); }
@media (max-width: 768px) { .audit-table .nowrap { white-space: normal; } }
/* C1: завантаження звітів */
.alert-danger { background: var(--error-bg); color: var(--error-text); }
.badge-received { background: #e8f0fe; border-color: #1d4ed8; color: #1e3a8a; }
.badge-rejected { background: var(--error-bg); border-color: #b91c1c; color: var(--error-text); }
.hash { font-family: ui-monospace, Menlo, monospace; font-size: .85rem; overflow-wrap: anywhere; user-select: all; }
.btn-sm { padding: .15rem .6rem; font-size: .85rem; }
.filename { overflow-wrap: anywhere; margin: 0; }
.filename-cell { overflow-wrap: anywhere; max-width: 32rem; }
.card-stub { background: #f3f4f6; color: #374151; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.field input[type=file] { border: 0; padding: .25rem 0; }
.nav-sub { list-style: none; margin: 0; padding-left: .75rem; font-size: .9rem; }
/* C2: розбір звітів */
.badge-ok { background: #dcfce7; border-color: #15803d; color: #14532d; }
.badge-info { background: #e0f2fe; border-color: #0369a1; color: #0c4a6e; }
.status-hint { margin: 0 0 .5rem; }
.issue-list { list-style: none; padding: 0; margin: 0; }
.issue-list li { margin-bottom: .4rem; }
.raw { font-family: ui-monospace, Menlo, monospace; font-size: .85rem; overflow-wrap: anywhere; }
.stub-line { color: var(--muted); }
.spinner-border { display: inline-block; width: 1rem; height: 1rem; margin-left: .5rem; vertical-align: middle; border: .15em solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner-border { animation-duration: 3s; } }
.badge, .badge-unavailable { white-space: nowrap; }
/* C3: реєстр, картка, предпросмотр, зіставлення */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem; margin: 0 0 .5rem; padding: 0; font-size: .9rem; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-right: .25rem; }
.crumbs a { color: var(--muted); }
.filter-group { border: 1px solid var(--border); border-radius: 6px; padding: .4rem .75rem .6rem; display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; margin: 0; }
.filter-group legend { font-weight: 600; font-size: .9rem; padding: 0 .25rem; }
.period-hint { flex-basis: 100%; margin: 0; font-size: .8rem; }
.filter-checks { display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; flex-basis: 100%; }
.filter-check { display: flex; align-items: center; gap: .35rem; }
.filter-check label { margin: 0; font-weight: 400; }
.filter-check input { width: 1.1rem; height: 1.1rem; }
.filter .field-error { font-size: .8rem; }
.totals, .counters-line, .filtered-count { margin: 0 0 .5rem; }
.counters-line { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .5rem .9rem; }
.filtered-count { border-left: 4px solid var(--focus); padding-left: .6rem; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.qty-null { color: var(--muted); }
.qty-neg { color: #92400e; font-weight: 600; }
.row-actions a { white-space: nowrap; margin-right: .5rem; }
.tabs ul { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem; margin: 0 0 1rem; padding: 0; border-bottom: 1px solid var(--border); }
.tabs a, .tabs .tab-disabled { display: block; padding: .5rem .9rem; border: 1px solid transparent; border-bottom: 0; border-radius: 6px 6px 0 0; text-decoration: none; color: var(--text); }
.tabs a.is-active { background: var(--surface); border-color: var(--border); font-weight: 700; margin-bottom: -1px; }
.tabs .tab-disabled { color: var(--muted); cursor: not-allowed; }
.tabs small { font-size: .75rem; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .75rem; margin: 0; }
.metric { border: 1px solid var(--border); border-radius: 6px; padding: .5rem .75rem; }
.metric dt { font-size: .85rem; color: var(--muted); font-weight: 600; }
.metric dd { margin: 0; font-size: 1.4rem; font-weight: 700; }
.metric-note { display: block; font-size: .75rem; font-weight: 400; }
.metric-stub { background: #f3f4f6; }
.history-list { margin: 0; padding-left: 1.25rem; }
.history-list li { margin-bottom: .3rem; }
.action-with-note { display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.alert-secondary { background: #f3f4f6; color: #374151; }
.badge-outline { background: transparent; }
.match-ok { color: #14532d; }
.store-cell { min-width: 11rem; }
.rows-table tr.row-error > :first-child { box-shadow: inset 4px 0 0 #b91c1c; }
.rows-table tr.row-warning > :first-child { box-shadow: inset 4px 0 0 #b45309; }
.check-err { color: #b91c1c; font-weight: 700; } .check-warn { color: #b45309; font-weight: 700; } .check-ok { color: #15803d; font-weight: 700; }
.row-details summary { cursor: pointer; white-space: nowrap; }
.row-details[open] .row-details-body { min-width: 22rem; max-width: 36rem; padding-top: .25rem; }
.row-details-body p { margin: 0 0 .25rem; font-size: .85rem; }
.sticky-col { position: sticky; left: 0; background: var(--surface); z-index: 1; }
thead .sticky-col { background: #eef0f4; }
.rows-table th[scope="row"] { font-weight: 400; background: var(--surface); }
.file-line { margin: 0 0 .25rem; font-size: .9rem; }
@media (max-width: 768px) {
  .rows-table .col-opt { display: none; }
  .filter-group { flex: 1 1 100%; }
}
.table-wrap { position: relative; } /* visually-hidden усередині таблиці не розширює сторінку */
/* C4: приймання, заміна, зіставлення */
.alert-success { background: #dcfce7; color: #14532d; }
.btn-danger { background: #b91c1c; color: #fff; }
.btn-danger:hover { background: #991b1b; }
.btn-outline-danger { background: var(--surface); color: #b91c1c; border-color: #b91c1c; }
.acceptance-block h2 { font-size: 1rem; margin: 0 0 .35rem; }
.acceptance-block .actions { margin: .5rem 0 0; }
.inline-form { margin: .2rem 0; }
.inline-form > summary { cursor: pointer; color: var(--accent-hover); }
.inline-form form { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .4rem; }
/* DEV-022f: згорнута секція «Розпізнані магазини» і форма зміни прив'язки */
details.card > summary { cursor: pointer; }
details.card > summary > h2 { display: inline; }
.reassign-form form { display: block; }
.reassign-form label { display: block; }
.reassign-form textarea, .reassign-form select { width: 100%; max-width: 28rem; }
.reassign-form .invalid-feedback { color: var(--error-text); margin: .25rem 0 0; }
.reassign-form [aria-invalid="true"] { border-color: var(--error-text); }
form.card > fieldset { border: 1px solid var(--border); border-radius: 6px; padding: .5rem .9rem; }
form.card > fieldset > legend { font-weight: 600; padding: 0 .3rem; }
/* C5 «Дані»: лише перегляд, липка шапка, рядки замінених наборів (не лише колір — є бейдж «Замінено»). */
.readonly-badge { font-size: .8rem; vertical-align: middle; margin-left: .5rem; }
.btn-outline-primary { background: var(--surface); color: var(--accent-hover); border-color: var(--accent); }
.btn-outline-primary:hover { background: #fff7ed; }
.radio-group { border: 1px solid var(--border); border-radius: 6px; padding: .3rem .6rem; margin: 0; display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.radio-group legend { font-weight: 600; font-size: .9rem; padding: 0 .25rem; }
.facts-wrap { max-height: 75vh; overflow: auto; }
.facts-table thead th { position: sticky; top: 0; z-index: 1; }
.facts-table td.num { font-variant-numeric: tabular-nums; }
.facts-table tr.row-superseded td { background: #f3f4f6; color: #374151; }
/* DEV-002 B: форми графіка — радіо/прапорці не розтягуються, select як поле вводу. */
.field .filter-check input, .field input[type=radio], .field input[type=checkbox] { width: auto; }
.field select { width: 100%; padding: .5rem; font: inherit; border: 1px solid #8a92a0; border-radius: 6px; background: var(--surface); }
.field select[aria-invalid="true"] { border-color: var(--error-text); }
fieldset.field { border: 0; padding: 0; margin: 0 0 1rem; }
fieldset.field legend { font-weight: 600; margin-bottom: .25rem; }

/* DEV-002 C: матриця надходження. Колір вторинний — статус завжди словом. */
.arrival-table th, .arrival-table td { white-space: nowrap; }
.arrival-table .sticky-col-2 { left: 4.5rem; }
.arrival-table th.sticky-col { min-width: 4.5rem; }
.arrival-table th.is-current { background: #fff7ed; }
.arrival-cell.is-dimmed { opacity: .45; }
.arrival-cell a:focus-visible { outline: 3px solid #1d4ed8; outline-offset: 1px; }
.arrival-status { display: inline-block; padding: .1rem .45rem; border-radius: 4px; font-size: .85rem; }
.text-bg-success { background: #dcfce7; color: #14532d; }
.text-bg-info { background: #e0f2fe; color: #0c4a6e; }
.text-bg-warning { background: #fef3c7; color: #78350f; }
.text-bg-danger { background: #fee2e2; color: #7f1d1d; }
.text-bg-light { background: #f9fafb; color: #111827; }
.arrival-status.border { border: 1px solid #9ca3af; }
.text-body-secondary { color: #4b5563; }
.fst-italic { font-style: italic; }
.badge-off-schedule { background: #4b5563; color: #fff; border-radius: 999px; padding: .1rem .5rem; font-size: .8rem; text-decoration: none; }
.arrival-counters { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; margin: 0 0 1rem; }
.arrival-counter { display: inline-block; border: 1px solid #9ca3af; border-radius: 6px; padding: .25rem .7rem; }
.arrival-counter.is-active { background: #1f2937; color: #fff; }
/* DEV-003a: асортимент */
.text-bg-secondary { background: #4b5563; color: #fff; }
.counters { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin: 0 0 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .5rem .9rem; }
.counters dt { font-weight: 600; color: var(--muted); font-size: .85rem; }
.counters dd { margin: 0; font-variant-numeric: tabular-nums; font-size: 1.1rem; }
.btn.is-disabled { opacity: .7; cursor: not-allowed; }
.meta-line { margin: 0 0 .25rem; }
.readiness-note { font-weight: 600; }
.hint-details { margin: .5rem 0 1rem; }
/* DEV-003c: сітка «товар × магазин» (02-ux C §3–§4) */
.mono { font-family: ui-monospace, Menlo, monospace; }
.btn-sm { padding: .2rem .55rem; font-size: .85rem; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-hover); text-decoration: underline; cursor: pointer; }
.menu { position: relative; display: inline-block; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu[open] > .menu-list { display: block; }
.menu-list { display: none; position: absolute; right: 0; z-index: 5; min-width: 18rem; margin: .25rem 0 0; padding: .4rem 0; list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.menu-list li { padding: .35rem .9rem; }
.menu-list .is-disabled { color: var(--muted); cursor: not-allowed; }
.menu-note { display: block; color: var(--muted); font-size: .8rem; }
.menu-note[hidden] { display: none; }
.menu-format { font-size: .75rem; color: var(--muted); border-top: 1px solid var(--border); margin-top: .3rem; padding-top: .4rem !important; white-space: normal; }
.menu-list li { white-space: normal; }
.grid-toolbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.grid-toolbar .date-form { margin-bottom: 0; }
.grid-legend { font-size: .85rem; color: var(--muted); margin: 0 0 .5rem; }
.grid-loading { color: var(--muted); margin-bottom: .5rem; }
.grid-wrap { max-height: 75vh; overflow: auto; }
.grid-table { border-collapse: separate; border-spacing: 0; }
.grid-table th, .grid-table td { border-bottom: 1px solid var(--border); padding: .25rem .45rem; white-space: nowrap; }
.grid-table thead th { position: sticky; top: 0; z-index: 2; background: #eef0f4; vertical-align: bottom; }
.grid-table thead th.sticky-col, .grid-table thead th.sticky-right { z-index: 3; }
.grid-table tfoot td, .grid-table tfoot th { position: sticky; bottom: 0; background: #eef0f4; z-index: 2; font-size: .85rem; }
.grid-table .sticky-col { position: sticky; background: var(--surface); z-index: 1; }
.grid-table .col-check { left: 0; width: 2rem; min-width: 2rem; }
.grid-table .col-article { left: 0; min-width: 6.5rem; }
.grid-table .col-article.has-check { left: 2rem; }
.grid-table .col-name { left: 6.5rem; min-width: 12rem; max-width: 16rem; overflow: hidden; text-overflow: ellipsis; box-shadow: inset -1px 0 0 var(--border); }
.grid-table .col-name.has-check { left: 8.5rem; }
.grid-table .col-foot { left: 0; }
.grid-table .sticky-right { position: sticky; background: var(--surface); z-index: 1; }
.grid-table .col-rsum { right: 0; min-width: 5rem; }
.grid-table .col-rstores { right: 5rem; min-width: 5.5rem; box-shadow: inset 1px 0 0 var(--border); }
.grid-table tfoot .sticky-col, .grid-table tfoot .sticky-right { z-index: 3; background: #eef0f4; }
.grid-table .col-store { min-width: 4.5rem; font-weight: 600; }
.grid-table .store-name { font-weight: 400; color: var(--muted); }
.grid-table tbody tr:hover td, .grid-table tbody tr:hover th { background: #f8fafc; }
.gcell { position: relative; min-width: 4.5rem; }
.gcell .cell-btn { display: inline-block; min-width: 2rem; padding: .1rem .2rem; color: var(--text); text-decoration: none; border-radius: 4px; }
.gcell .cell-btn:hover { background: #eef2ff; }
.gcell .cell-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; }
.cell-mark { font-size: .75rem; margin-left: .15rem; color: var(--muted); }
.cell-warn { color: #92400e; }
.diff-note { display: block; font-size: .72rem; color: #4b5563; line-height: 1.1; }
.diff-changed { box-shadow: inset 3px 0 0 #b45309; }
.diff-added { box-shadow: inset 3px 0 0 #15803d; }
.diff-removed { box-shadow: inset 3px 0 0 #b91c1c; }
.diff-sample { padding-left: .35rem; }
.is-zero-hl { background: #fffbeb; }
.col-total { font-size: .8rem; line-height: 1.2; }
.gcell.is-editing { min-width: 16rem; text-align: left !important; white-space: normal; }
.cell-form { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.cell-form input[name=value] { width: 5rem; padding: .2rem .35rem; font: inherit; border: 1px solid #8a92a0; border-radius: 4px; }
.cell-form input[aria-invalid="true"] { border-color: var(--error-text); }
.cell-form .field-error { flex-basis: 100%; }
.cell-form-origin { flex-basis: 100%; }
.cell-origin { margin: .2rem 0 0; font-size: .8rem; color: var(--muted); white-space: normal; }
.cell-popover { position: absolute; z-index: 20; max-width: 22rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .6rem 2rem .6rem .8rem; box-shadow: 0 6px 18px rgba(0,0,0,.15); }
.cell-popover p { margin: 0 0 .25rem; }
.popover-close { position: absolute; top: .25rem; right: .35rem; background: none; border: 0; font-size: 1.2rem; cursor: pointer; }
.issues-panel summary { cursor: pointer; }
.issue-codes { margin: .5rem 0; padding-left: 1.25rem; }
.bulk-panel .actions { margin: .25rem 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.bulk-title { font-size: 1rem !important; }
.select-all-filter { margin: 0 0 .5rem; }
.store-search { display: block; margin-bottom: .25rem; }
.diff-line { font-weight: 600; }

/* DEV-003d: атрибути товару (02-ux D §3, §6) */
.product-btn { color: var(--text); text-decoration: underline dotted; }
.product-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.attr-list { margin: 0; display: grid; gap: .15rem; }
.attr-list > div { display: grid; grid-template-columns: 9rem 1fr; gap: .5rem; }
.attr-list dt { font-weight: 600; }
.attr-list dd { margin: 0; overflow-wrap: anywhere; }
/* DEV-004 B: публічні сторінки доступу */
.form-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-top: 1rem; }
.password-rules { border: 1px solid #d1d5db; border-radius: 6px; padding: .5rem .9rem; margin: 0 0 1rem; font-size: .9rem; }
.password-rules-title { font-weight: 600; margin: 0 0 .25rem; }
.password-rules ul { margin: 0; padding-left: 1.2rem; }
.field-error .alert-line + .alert-line { margin-top: .25rem; }
button[disabled][aria-busy="true"] { opacity: .65; cursor: progress; }

/* DEV-004 C: користувачі та призначення */
.badge-state-invited { background: #fef3c7; border-color: #b45309; color: #78350f; }
.badge-state-active { background: #dcfce7; border-color: #15803d; color: #14532d; }
.badge-state-deactivated { background: #e5e7eb; border-color: #4b5563; color: #1f2937; }
.page-title .badge { vertical-align: middle; font-size: .85rem; }
.page-actions { display: flex; justify-content: flex-end; margin: -.5rem 0 1rem; }
.text-danger { color: #b91c1c; }
.form-card { max-width: 44rem; }
.copy-line { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: .25rem 0 .5rem; }
.copy-line input { flex: 1; min-width: 16rem; font: inherit; font-family: ui-monospace, monospace; font-size: .85rem; padding: .35rem .5rem; border: 1px solid #8a92a0; border-radius: 6px; background: var(--surface); }
.field textarea { width: 100%; padding: .5rem; font: inherit; border: 1px solid #8a92a0; border-radius: 6px; }
.field textarea[aria-invalid="true"] { border-color: var(--error-text); }
.field-hint { margin: .25rem 0 0; }
.scope-field { border: 1px solid var(--border); border-radius: 6px; padding: .5rem .9rem; }
.scope-field legend { font-weight: 600; padding: 0 .25rem; }
.scope-dims { margin: .5rem 0 0 1.5rem; }
.scope-dims.is-muted { opacity: .6; }
.preview-box { border: 1px solid var(--border); border-radius: 6px; padding: .5rem .9rem; background: #fafbfc; margin-bottom: .5rem; }
.preview-box h3 { margin: 0 0 .25rem; font-size: 1rem; }
.preview-result h4 { margin: .5rem 0 .25rem; font-size: .95rem; }
.perm-list.pairs { margin: .25rem 0; padding-left: 1.25rem; }
.form-actions .spacer { flex: 1; }
dialog.modal { border: 0; border-radius: 10px; padding: 1rem 1.25rem; width: min(42rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); overflow: auto; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
dialog.modal::backdrop { background: rgba(17,24,39,.5); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.modal-head h2 { margin: 0 0 .75rem; font-size: 1.15rem; }
.modal-head .link-btn { font-size: 1.5rem; line-height: 1; }
.modal-only { display: none; }
dialog .modal-only { display: flex; }

/* DEV-004 D: редактор ролей */
.badge-role-system { background: #e0f2fe; border-color: #0369a1; color: #0c4a6e; }
.badge-role-archived { background: #e5e7eb; border-color: #4b5563; color: #1f2937; }
.badge-readonly { background: #fff; border-color: #9ca3af; color: #374151; font-weight: 500; }
.small { font-size: .85rem; }
.btn-warning { background: #f59e0b; border-color: #b45309; color: #1f2937; }
.btn-warning:hover { background: #d97706; }
.card.narrow { max-width: 42rem; }
.head-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-left: auto; }
.role-desc { max-width: 32rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; }
.role-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.role-side { position: sticky; top: 1rem; display: grid; gap: 1rem; }
.role-side .card { margin: 0; }
@media (max-width: 992px) { .role-layout { grid-template-columns: minmax(0, 1fr); } .role-side { position: static; } }
.perm-head h2 { margin: 1rem 0 .25rem; }
.perm-group { border: 1px solid var(--border); border-radius: 6px; margin: .5rem 0; padding: .25rem .75rem; }
.perm-group > summary { cursor: pointer; font-weight: 600; padding: .35rem 0; }
.perm-group fieldset { border: 0; margin: 0; padding: 0; }
.perm-group-actions { margin: .25rem 0; font-size: .85rem; }
.perm-list { list-style: none; margin: 0; padding: 0 0 .25rem; }
.perm-row { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; padding: .3rem 0; border-top: 1px solid var(--border); }
.perm-row:first-child { border-top: 0; }
.perm-row label { font-weight: 500; }
.perm-row input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.role-users { list-style: none; margin: 0; padding: 0; }
.role-users li { padding: .2rem 0; }
.preview-indicator { display: none; margin: 0 0 .25rem; }
.preview-indicator.htmx-request { display: block; }
.preview-label { margin: .5rem 0 .15rem; font-weight: 600; }
.preview-list { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
/* DEV-004 E: плашка області делегата */
.alert-light { background: #fff; color: #1f2937; }
.alert-light.border { border: 1px solid #d1d5db; }
.delegate-scope .alert-line + .alert-line, .delegate-scope details { margin-top: .25rem; }
.delegate-scope details summary { cursor: pointer; text-decoration: underline; }
.text-muted.small { color: #4b5563; font-size: .875rem; }
/* DEV-020-B: таблиця-картки на вузькому екрані (td[data-label]) */
@media (max-width: 576px) {
  .stack-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .stack-table, .stack-table tbody, .stack-table tr, .stack-table td { display: block; width: 100%; }
  .stack-table tr { border-bottom: 1px solid var(--border); padding: .4rem 0; }
  .stack-table td { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: .5rem; border: 0; overflow-wrap: anywhere; }
  .stack-table td::before { content: attr(data-label); font-weight: 600; color: #4b5563; }
}
/* DEV-020 C: попередній перегляд ТТ */
.tt-group > summary { cursor: pointer; list-style-position: inside; }
.tt-group > summary h2 { display: inline; font-size: 1.05rem; margin: 0; }
.tt-group[open] > summary { margin-bottom: .75rem; }
.sha { overflow-wrap: anywhere; word-break: break-all; }
.tt-date { margin-bottom: .25rem; }

/* DEV-020 D — дії картки магазину */
.store-actions .action-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .5rem; }
.btn-link { background: none; border-color: transparent; color: var(--link, #1d4ed8); text-decoration: underline; }
.store-action-form .form-field { display: flex; flex-direction: column; gap: .25rem; margin: 0 0 .85rem; }
.store-action-form .form-field input[type=text], .store-action-form .form-field select, .store-action-form .form-field textarea { max-width: 100%; }
.store-action-form .form-check { flex-direction: row; align-items: center; flex-wrap: wrap; }
.store-action-form .form-check .field-error { flex-basis: 100%; }
.store-action-form .form-actions { justify-content: flex-end; }
.store-action-form [aria-invalid=true] { border-color: var(--error-text); }

/* Довідник товарів (DEV-020 E) */
.list-unstyled { list-style: none; padding-left: 0; margin: 0; }
.mb-0 { margin-bottom: 0; }
.value-stack li { min-height: 1.6em; line-height: 1.6em; white-space: nowrap; }
.filter-unknown { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: center; }
.filter-unknown legend { float: left; margin-right: .5rem; font-size: inherit; }
.filter-unknown small { flex-basis: 100%; }
.form-check-inline { display: inline-flex; gap: .25rem; align-items: center; }
.supplier-block { margin-top: 1rem; }
.supplier-block h3 { margin-top: 0; }
.matrix-attributes { margin-top: 1rem; }

/* Сповіщення (DEV-005 B) */
.badge.bg-danger { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.badge.bg-warning { background: #fde68a; border-color: #b45309; color: #1f2937; }
.badge.bg-secondary { background: #e5e7eb; border-color: #6b7280; color: #1f2937; }
.badge.bg-primary { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
.badge.bg-info { background: #bae6fd; border-color: #0369a1; color: #0c4a6e; }
.badge.bg-success { background: #15803d; border-color: #15803d; color: #fff; }
.needs-assignment { color: #92400e; font-weight: 600; }
.unread-dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: var(--accent); vertical-align: middle; margin-right: .3rem; }
.notif-row.is-unread td { font-weight: 600; }
.notif-row.is-unread td .small { font-weight: 400; }
.notif-row:target { outline: 2px solid var(--focus); outline-offset: -2px; }
.notif-actions form { display: inline-block; margin: 0 .25rem .25rem 0; }
.notif-actions .inline-form form { margin-top: .2rem; }
.read-all { text-align: right; }
.read-all form { margin: 0; }
.read-all p { margin: .2rem 0 0; }
.snoozed-note { white-space: nowrap; }
.d-block { display: block; }
.nav-badge { display: inline-block; min-width: 1.4rem; padding: 0 .35rem; margin-left: .25rem; border-radius: 999px; background: #b91c1c; color: #fff; font-size: .75rem; text-align: center; }
.bell { position: relative; }
.bell-btn { position: relative; display: inline-flex; align-items: center; padding: .35rem; color: var(--text); border-radius: 6px; }
.bell-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.bell-badge { position: absolute; top: -.2rem; right: -.45rem; min-width: 1.2rem; padding: 0 .3rem; border-radius: 999px; background: #b91c1c; color: #fff; font-size: .7rem; font-weight: 700; line-height: 1.2rem; text-align: center; }
.bell-panel { position: absolute; right: 0; top: calc(100% + .35rem); z-index: 20; width: min(26rem, calc(100vw - 2rem)); max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.bell-head, .bell-foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .5rem .75rem; }
.bell-head { border-bottom: 1px solid var(--border); }
.bell-head form { margin: 0; }
.bell-foot { border-top: 1px solid var(--border); }
.bell-list { list-style: none; margin: 0; padding: 0; }
.bell-list li a { display: block; padding: .5rem .75rem; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border); }
.bell-list li a:hover, .bell-list li a:focus-visible { background: #f3f4f6; }
.bell-list li.is-unread a { font-weight: 600; }
.bell-list .small { font-weight: 400; }
.bell-empty, .bell-error { margin: 0; padding: 1rem .75rem; text-align: center; }
.problem-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(16rem, 1fr); gap: 1rem; align-items: start; }
.problem-actions form { margin: 0 0 .5rem; }
.problem-actions textarea { width: 100%; box-sizing: border-box; }
.problem-actions .inline-form form { display: block; }
.detail-head .badge { margin-right: .35rem; }
@media (max-width: 800px) { .problem-layout { grid-template-columns: 1fr; } .read-all { text-align: left; } }
@media (max-width: 640px) { .bell-panel { position: fixed; left: 1rem; right: 1rem; top: 4rem; width: auto; } }
/* DEV-005 C: блок «Відповідальний», пометка «без доступу». */
.problem-side { display: grid; gap: 1rem; }
.no-access-mark { color: #92400e; font-size: .875rem; }
.responsible-block select, .responsible-block input[type="search"] { width: 100%; box-sizing: border-box; margin-bottom: .25rem; }
.responsible-block form { margin: 0 0 .5rem; }
.responsible-block dialog p { margin-top: 0; }

/* DEV-005 D: канали сповіщень (UX D2/D3) */
.tg-steps { padding-left: 1.25rem; }
.tg-command-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .35rem; }
.tg-command { font-family: ui-monospace, Menlo, monospace; font-size: 1.25rem; padding: .2rem .5rem; background: #f3f4f6; border: 1px solid var(--border); border-radius: 6px; word-break: break-all; }
.dev-panel { border: 2px dashed #b45309; }

/* DEV-006 A: меню з реєстру — заголовки розділів, бейдж «У розробці», числа */
.nav-menu .nav-item { display: flex; align-items: center; gap: .4rem; }
.nav-menu .nav-label { flex: 1 1 auto; min-width: 0; }
.ms-auto { margin-left: auto; }
.badge.text-bg-secondary { background: #e5e7eb; border-color: #6b7280; color: #1f2937; font-weight: 500; }
.nav-menu .badge.text-bg-secondary { font-size: .68rem; padding: 0 .45rem; flex-shrink: 0; }
.stub-note { display: flex; gap: .6rem; align-items: flex-start; }
.stub-note p { margin: 0 0 .35rem; }
.stub-icon { font-size: 1.1rem; line-height: 1.3; }
.btn-outline-secondary { background: transparent; border: 1px solid #6b7280; color: #374151; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Глобальний пошук у шапці (DEV-006 D) */
.nav-search { position: relative; flex: 1 1 22.5rem; max-width: 22.5rem; }
.nav-search-form { position: relative; margin: 0; }
.nav-search input[type="search"] { width: 100%; padding: .4rem 2rem .4rem .6rem; border: 1px solid var(--border); border-radius: 6px; }
.nav-search input[type="search"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.nav-search-spinner { position: absolute; right: .6rem; top: 50%; width: .9rem; height: .9rem; margin-top: -.45rem; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: nav-search-spin .8s linear infinite; }
@keyframes nav-search-spin { to { transform: rotate(360deg); } }
.nav-search-panel { position: absolute; z-index: 50; left: 0; right: 0; top: calc(100% + .25rem); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.12); max-height: 70vh; overflow-y: auto; min-width: 18rem; }
.nav-search-panel.is-loading { opacity: .55; }
.search-list { list-style: none; margin: 0; padding: .25rem 0; }
.search-group-title { padding: .4rem .75rem .15rem; font-size: .75rem; font-weight: 700; text-transform: uppercase; color: var(--muted); }
.search-option { display: block; padding: .3rem .75rem; color: inherit; text-decoration: none; overflow-wrap: anywhere; }
.search-option:hover, .search-option:focus, .search-option.is-active { background: #eef0f4; outline: none; }
.search-option:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.search-all { border-top: 1px solid var(--border); margin-top: .25rem; }
.search-msg { margin: 0; padding: .6rem .75rem; }
.sh-key { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; }
.search-section { margin-bottom: 1.25rem; }
.search-section-title { font-size: 1.1rem; margin: 0; }
mark { background: #fde68a; color: inherit; padding: 0; }
@media (max-width: 768px) { .nav-search { flex-basis: 100%; max-width: none; order: 3; } }
/* Загальний фільтр і види (DEV-006 E). */
.common-filter { background: var(--surface); border: 1px solid var(--border); padding: .75rem 1rem; margin: 0 0 1rem; border-radius: 8px; }
.cf-toggle { display: none; }
.cf-form { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.cf-fields { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; border: 0; margin: 0; padding: 0; }
.cf-fields .filter label { font-size: .8rem; font-weight: 500; color: var(--muted); margin-bottom: .25rem; white-space: nowrap; }
.cf-fields .filter select { width: 9.5rem; }
.cf-fields .cf-period select { width: 15.5rem; }
.cf-fields .cf-dates input { width: 9.5rem; }
.cf-period-range { color: var(--text, inherit); font-variant-numeric: tabular-nums; margin-left: .25rem; }
.cf-actions { flex-wrap: nowrap; align-items: center; flex: 1 1 0; min-width: max-content; }
.cf-views-group { display: flex; gap: .25rem; margin-left: auto; }
.cf-views { position: relative; }
.cf-views > summary { list-style: none; }
.cf-views > summary::-webkit-details-marker { display: none; }
.cf-views-menu { position: absolute; right: 0; z-index: 20; min-width: 16rem; list-style: none; margin: .25rem 0 0; padding: .4rem 0; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.cf-views-menu li { padding: .25rem .9rem; }
.cf-views-manage { border-top: 1px solid var(--border); margin-top: .25rem; }
.cf-chips { margin: .75rem 0 0; padding-top: .75rem; border-top: 1px solid var(--border); font-size: .85rem; display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; }
.cf-chips .chip { margin: .15rem 0; }
.cf-period-note { margin-left: auto; color: var(--muted); font-size: .8rem; }
.cf-empty-scope { margin: 0; }
.cf-dialog { border: 1px solid var(--border); border-radius: 8px; padding: 1.25rem; max-width: 32rem; width: calc(100% - 2rem); }
.cf-dialog::backdrop { background: rgba(0,0,0,.35); }
.cf-dialog h2 { margin-top: 0; font-size: 1.15rem; }
.cf-preview { margin: 0 0 1rem; padding-left: 1.25rem; }
.cf-dialog-actions { justify-content: flex-end; }
@media (max-width: 767.98px) {
  .cf-toggle { display: inline-block; }
  .cf-collapse[open] > .cf-toggle { margin-bottom: .75rem; }
  .cf-fields { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .cf-fields .cf-period { grid-column: 1 / -1; }
  .cf-fields .filter select, .cf-fields .cf-period select, .cf-fields .cf-dates input { width: 100%; }
  .cf-actions { flex-wrap: wrap; min-width: 0; flex-basis: 100%; }
  .cf-period-note { margin-left: 0; }
}
@media (min-width: 768px) {
  .cf-collapse > summary { display: none; }
}

/* DEV-006 F: головна — сітка блоків, лічильники «Потребує уваги», заглушка середи. */
.home-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; align-items: start; }
.home-grid > .home-block { margin: 0; min-width: 0; }
@media (min-width: 992px) { .home-grid { grid-template-columns: 1fr 1fr; } .home-grid > .col-12 { grid-column: 1 / -1; } }
.home-attention { list-style: none; margin: 0; padding: 0; }
.home-attention .list-group-item { padding: .5rem 0; border-bottom: 1px solid var(--border, #e5e7eb); }
.home-attention .list-group-item:last-child { border-bottom: 0; }
.home-counter { display: flex; align-items: center; gap: .5rem; justify-content: space-between; }
.home-counter .badge { margin-left: auto; }
.home-details summary { cursor: pointer; font-size: .85rem; }
.home-details ul { margin: .25rem 0 0; padding-left: 1.25rem; font-size: .85rem; }
.home-stub.bg-body-tertiary { background: #f3f4f6; }
.text-success { color: #15803d; }
.home-block .table-wrap { margin-bottom: .75rem; }
.home-block .table td .muted { font-size: .85rem; }
.home-loading .spinner-border { margin: 0 .35rem 0 0; }
.status-sections { columns: 2 14rem; margin: 0; padding-left: 1.25rem; }
.d-block { display: block; }
/* DEV-022e: загальна черга зіставлення */
.queue-table .queue-sample { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-table .queue-actions { min-width: 16rem; }
.queue-table tr[aria-busy="true"] { opacity: .6; }
.queue-scope { flex-basis: 100%; margin: 0; }
#queue-status:empty { display: none; }
/* DEV-007 E: історія залишку */
.history-table .series-caption { caption-side: top; text-align: left; font-weight: 600; padding: .5rem 0; }
.stock-history-series + .stock-history-series { margin-top: 1rem; }
.only-sm { display: none; }
@media (max-width: 768px) { .hide-sm { display: none; } .only-sm { display: inline-block; } }
/* DEV-008c: атрибути з файлу постачальника (форма, картка, diff) */
.attr-fields { border: 1px solid #d1d5db; border-radius: 6px; padding: .5rem 1rem; margin: 0 0 1rem; }
.attr-fields[hidden], [data-past-confirm][hidden] { display: none; }
.attr-columns { margin: 0 0 1rem; padding-left: 1.2rem; }
fieldset.filter { border: 0; padding: 0; margin: 0; }
fieldset.filter legend { font-weight: 600; font-size: .9rem; }
.check-inline { display: inline-flex; gap: .25rem; align-items: center; margin-right: .75rem; font-weight: 400; }
.text-muted { color: #4b5563; }
.attr-diff td, .attr-diff th[scope="row"] { vertical-align: top; }
.kv-compact { font-size: .85rem; margin: .25rem 0 0; }

/* DEV-009 D: перевірка каналу і журнал доставок */
.channel-test-form { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.channel-test-form.htmx-request .htmx-indicator,
.filters.htmx-request .htmx-indicator { display: inline-flex; align-items: center; }
.channel-test-result .alert { margin-bottom: .5rem; }
.alert-compact { margin: .25rem .5rem; padding: .35rem .5rem; }

/* DEV-023 C: календарі відділів */
.text-bg-dark { background: #1f2937; color: #fff; }
.status-badge.text-bg-light { border: 1px solid #6b7280; }
.status-badge.text-bg-secondary { border-color: #4b5563; }
.text-warning { color: #92400e; }
.page-title .status-badge { font-size: .9rem; vertical-align: middle; }
.planning-create { padding: .5rem 1rem; }
.planning-create > summary { list-style: none; display: inline-block; }
.planning-create > summary::-webkit-details-marker { display: none; }
.planning-create[open] > summary { margin-bottom: .75rem; }
.planning-layout { display: grid; grid-template-columns: 1fr; gap: 1rem; align-items: start; }
@media (min-width: 1200px) { .planning-layout { grid-template-columns: minmax(20rem, 5fr) 7fr; } }
.planning-form fieldset.form-group { border: 1px solid var(--border); border-radius: 6px; padding: .5rem 1rem; margin: 0 0 1rem; }
.planning-form legend { font-weight: 600; padding: 0 .25rem; }
.planning-form .field input, .planning-form .field select, .planning-form .field textarea { max-width: 100%; }
.planning-form .is-invalid { border-color: #b91c1c; }
.range-pair { display: flex; flex-wrap: wrap; gap: 0 1rem; }
.range-pair .field { flex: 1 1 10rem; }
.h-sm { font-size: 1.1rem; margin: 0 0 .5rem; }
.modal-sub { font-size: 1rem; margin: .5rem 0 .25rem; }
#preview.is-loading { opacity: .55; }
.preview-loading.htmx-request { display: block; }
.row-warn { background: #fffbeb; }
.row-actions { display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: center; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.nwd-form .filters { margin-bottom: 0; }
.badge.status-badge.text-bg-secondary { background: #4b5563; color: #fff; border-color: #4b5563; }
.badge.status-badge.text-bg-success { background: #dcfce7; color: #14532d; border-color: #15803d; }
.badge.status-badge.text-bg-info { background: #e0f2fe; color: #0c4a6e; border-color: #0369a1; }
.badge.status-badge.text-bg-light { background: #f9fafb; color: #111827; border-color: #6b7280; }
.badge.status-badge.text-bg-dark { background: #1f2937; color: #fff; border-color: #1f2937; }
.badge.text-bg-warning { background: #fef3c7; color: #78350f; border-color: #b45309; white-space: normal; }
/* DEV-023-D: сітка календаря */
.grid-period { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin: .5rem 0; }
.grid-period h2 { margin: 0; }
.grid-nav, .grid-views { display: flex; gap: .4rem; flex-wrap: wrap; }
.grid-views { margin-left: auto; }
.btn-group { border: 1px solid var(--border); border-radius: 6px; padding: .2rem .5rem .4rem; display: flex; gap: .75rem; margin: 0; }
.btn-group legend { font-weight: 600; font-size: .9rem; padding: 0 .25rem; }
.btn-radio { display: inline-flex; align-items: center; gap: .3rem; font-weight: 400 !important; }
.btn-outline-secondary { background: var(--surface); color: #374151; border-color: #6b7280; }
.text-bg-primary { background: #1d4ed8; color: #fff; }
.text-bg-light { border: 1px solid #6b7280; }
.text-body-secondary { color: #4b5563; }
.cal-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal-grid th, .cal-grid td { border: 1px solid var(--border); padding: .35rem .4rem; vertical-align: top; text-align: left; }
.cal-grid thead th { background: #eef0f4; font-size: .9rem; }
.cal-week td { min-height: 8rem; height: 8rem; }
.cal-month td { height: 6.5rem; font-size: .85rem; }
.cal-grid .is-today { border: 2px solid #1d4ed8; }
.cal-grid td.is-outside { background: #fafafa; color: #6b7280; }
.cal-grid td.is-nwd, .grid-day.is-nwd { background: #eceef2; }
.grid-today { font-weight: 400; font-size: .8rem; color: #1d4ed8; }
.grid-daynum { font-weight: 600; }
.grid-nwd { margin: 0 0 .25rem; font-size: .8rem; font-style: italic; color: #374151; }
.grid-events { list-style: none; padding: 0; margin: 0; }
.grid-events li { margin-bottom: .3rem; }
.grid-event { display: block; color: inherit; text-decoration: none; border-left: 3px solid #9ca3af; padding-left: .3rem; overflow-wrap: anywhere; }
.grid-event:hover { text-decoration: underline; }
.grid-event:focus-visible { outline: 2px solid #1d4ed8; outline-offset: 1px; }
.grid-event-cycle { border-left-color: var(--accent); font-weight: 600; }
.grid-event-cutoff { border-left-color: #1d4ed8; }
.grid-event.is-unknown { color: #4b5563; }
.grid-time { font-variant-numeric: tabular-nums; }
.grid-more { font-size: .8rem; }
.grid-legend { font-size: .85rem; margin-top: .5rem; }
.grid-legend p { margin: .2rem 0; }
.grid-narrow { display: none; }
.grid-day { border: 1px solid var(--border); border-radius: 6px; padding: .5rem; margin-bottom: .5rem; }
.grid-day.is-today { border: 2px solid #1d4ed8; }
[data-grid-results][aria-busy="true"] .cal-grid { opacity: .6; }
@media (max-width: 767.98px) { .grid-wide { display: none; } .grid-narrow { display: block; } }

/* DEV-014 C: блок «Продажі та попит», графік, лідери, деталізація U5 */
.mb-1 { margin-bottom: .25rem; }
.mb-2 { margin-bottom: .5rem; }
.fw-semibold { font-weight: 600; }
.h6 { font-size: 1rem; margin: 1rem 0 .4rem; }
.sales-controls { margin-bottom: 1rem; }
.home-block .sales-controls { margin: .75rem 0 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border, #e5e7eb); }
.home-block-actions { margin: 0 0 .75rem; }
.sales-badges .badge { margin-right: .25rem; white-space: normal; }
.sales-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: .75rem; margin-bottom: .75rem; }
.sales-card { position: relative; margin: 0; }
.sales-card:hover { border-color: var(--accent); }
.sales-card:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.sales-card-title { display: flex; gap: .35rem; align-items: flex-start; font-size: 1rem; margin: 0 0 .4rem; }
.sales-card-title a { color: var(--text); text-decoration: none; }
.sales-card-title a:focus-visible { outline: none; }
.stretched-link::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.sales-card .info-pop, .sales-card .raise { position: relative; z-index: 2; }
.sales-card-value { font-size: 1.5rem; font-weight: 700; margin: 0 0 .25rem; font-variant-numeric: tabular-nums; }
.info-pop { display: inline-block; }
.info-pop > summary { list-style: none; cursor: pointer; color: var(--muted); font-weight: 400; }
.info-pop > summary::-webkit-details-marker { display: none; }
.info-pop-body { position: absolute; z-index: 5; max-width: 22rem; min-width: 14rem; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: .5rem .75rem; font-size: .85rem; font-weight: 400; color: var(--text); box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.info-pop-inline { position: relative; }
.chg { font-variant-numeric: tabular-nums; white-space: nowrap; }
.chg-pct { margin-left: .4rem; }
.chg-up { color: #166534; }
.chg-down { color: #b91c1c; }
.sales-why { margin: 0 0 .75rem; font-size: .9rem; }
.sales-sub { margin-top: .75rem; }
.metric-chart { margin: 0 0 .5rem; }
.metric-chart svg { width: 100%; height: auto; max-height: 18rem; display: block; }
.mc-zero { stroke: #9ca3af; stroke-width: 1; }
.mc-cur { fill: none; stroke: var(--accent); stroke-width: 2; }
.mc-cmp { fill: none; stroke: #374151; stroke-width: 2; stroke-dasharray: 6 4; }
.mc-cur-pt { fill: var(--accent); }
.mc-cmp-pt { fill: #374151; }
.mc-key { display: inline-block; width: 1.5rem; height: 0; vertical-align: middle; border-top: 2px solid var(--accent); }
.mc-key-cmp { border-top: 2px dashed #374151; }
.an-tabs .tabs button { font: inherit; background: transparent; border: 1px solid transparent; border-bottom: 0; border-radius: 6px 6px 0 0; padding: .45rem .8rem; cursor: pointer; color: var(--text); }
.an-tabs .tabs button.is-active { background: var(--surface); border-color: var(--border); font-weight: 700; margin-bottom: -1px; }
.sticky-head th { position: sticky; top: 0; z-index: 1; }
.sort-link { color: inherit; }
.detail-table-box.is-loading { opacity: .6; }
.detail-summary { align-items: baseline; }
/* DEV-014 D: блок «Запас і поповнення» */
.border-dashed { border-style: dashed !important; }
.stock-stub { margin: 0; color: var(--muted); }
.stock-channels { display: flex; gap: 1.5rem; margin: 0 0 .25rem; }
.stock-channels > div { flex: 1 1 0; }
.stock-channels dt { font-weight: 600; font-size: .9rem; }
.stock-channels dd { margin: 0; }
.stock-card .sales-badges details, .stock-card p .info-pop { position: relative; z-index: 2; }
.neg { color: #b91c1c; }
.stock-date-form { margin: .5rem 0; }
.stock-neg-form { margin: 0 0 .5rem; }

/* DEV-014 E: переключатель «Склад» і картки асортименту */
.stock-mode-fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .75rem; }
.stock-mode-fieldset legend { float: none; width: auto; margin: 0; padding: 0; font-size: 1rem; }
.stock-block > .alert + .sales-cards, .stock-block .stock-cards + .stock-stubs { margin-top: .75rem; }
.asrt-grid th, .asrt-grid td { padding: .15rem .35rem; }
.asrt-grid td.num { white-space: nowrap; }
/* DEV-014 F: «Потребує уваги» (картки), «Якість даних», «Свіжість джерел». */
.tabular-nums { font-variant-numeric: tabular-nums; }
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .5rem; }
.home-att-card { margin: 0; padding: .6rem .75rem; display: flex; flex-direction: column; gap: .2rem; }
.home-att-card p { margin: 0; }
.att-title { display: block; font-weight: 600; margin: 0; }
.att-line { display: flex; align-items: center; gap: .5rem; }
.att-value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.att-arrow { margin-left: auto; }
.home-att-link { color: inherit; text-decoration: none; display: block; }
.home-att-link:hover .att-title, .home-att-link:focus-visible .att-title { text-decoration: underline; }
.att-stub { color: var(--muted); }
.home-attention + .alert, .alert + .home-attention { margin-top: .5rem; }
.badge-outline { background: transparent; border-color: #6b7280; color: #374151; }
.badge-outline-danger { background: transparent; border-color: #b91c1c; color: #991b1b; }
.quality-details > summary { cursor: pointer; }
.quality-details > summary > h2 { display: inline; margin: 0; }
.quality-grid { display: grid; gap: 1rem; margin-top: .75rem; }
@media (min-width: 992px) { .quality-grid { grid-template-columns: 1fr 1fr; } }
.quality-card { margin: 0 0 .75rem; padding: .75rem 1rem; }
.quality-card h3 { font-size: 1rem; margin: 0 0 .5rem; }
.status-list { list-style: none; margin: 0 0 .25rem; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem .9rem; }
.quality-table caption { caption-side: top; text-align: left; font-size: .85rem; color: var(--muted); padding-bottom: .25rem; }
.seg-switch { display: flex; gap: .35rem; margin: .5rem 0; }
.sources-table caption { caption-side: top; text-align: left; font-weight: 600; padding-bottom: .25rem; }
@media (max-width: 991px) { .sources-table .src-wide { display: none; } }
/* DEV-014 G: «Якість планування» і деталізації прогнозу/правок. */
.planning-cards .fs-3 { font-size: 1.5rem; }
.detail-table th.table-active, .detail-table td.table-active { background: #eef2ff; }
.pagination + p, .detail-summary details table { margin-top: .25rem; }
@media (max-width: 991px) { .detail-table .pq-wide { display: none; } }
/* DEV-014 H: меню вивантаження деталізації і «Мої вивантаження». */
.export-menu .menu-list button[disabled] { color: var(--muted); cursor: not-allowed; text-decoration: none; }
.export-menu .spinner-border { margin: 0 .3rem 0 0; }
.badge-failed { background: var(--error-bg); border-color: #b91c1c; color: #7f1d1d; }
.badge-expired { background: #e5e7eb; border-color: #4b5563; color: #1f2937; }
.exports-table details > summary { cursor: pointer; }

/* DEV-014 I: «Сезонні підказки» в блоці продажів і деталізації */
.sales-split { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-top: .75rem; }
@media (min-width: 992px) { .sales-split { grid-template-columns: 7fr 5fr; } .sales-split-side:only-child { grid-column: 1 / -1; } }
.sales-insights .ins-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.ins-list { list-style: none; padding: 0; margin: 0 0 .5rem; border: 1px solid var(--border, #d1d5db); border-radius: .375rem; }
.ins-item { padding: .5rem .75rem; border-top: 1px solid var(--border, #d1d5db); }
.ins-item:first-child { border-top: 0; }
.ins-badges .badge { margin-right: .25rem; white-space: normal; }
.ins-item-foot { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.placeholder-glow .placeholder { display: block; height: .9rem; margin-bottom: .4rem; background: #e5e7eb; border-radius: .25rem; animation: ins-glow 1.6s ease-in-out infinite; }
.placeholder.col-12 { width: 100%; } .placeholder.col-10 { width: 83%; } .placeholder.col-8 { width: 66%; }
@keyframes ins-glow { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .placeholder-glow .placeholder { animation: none; } }
.detail-insights { margin-top: 1rem; }
.rec-sc + .rec-sc::before { content: " · "; }
.rec-bulk-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; z-index: 5; }
.rec-bulk-bar[hidden] { display: none; }
/* DEV-015-I: картки K8 і елементи запасу центру */
.tabular-nums { font-variant-numeric: tabular-nums; }
.k8-split { display: flex; gap: 1.25rem; font-size: 1.25rem; font-weight: 600; }
.k8-split div { display: flex; gap: .35rem; }
.k8-split dt { font-weight: 400; }
.k8-split dd { margin: 0; }
.stock-item + a { display: inline-block; margin-top: .25rem; }

/* D-218: верхня навігація з 6 груп (<details>), на < 992px — вертикальна панель-акордеон */
.app-nav { position: relative; z-index: 100; background: var(--nav-bg); color: var(--nav-text); }
.app-nav-inner { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem; padding: .4rem 1rem; }
.brand { display: block; margin-right: .75rem; padding: .25rem .5rem; background: #fff; border-radius: 6px; line-height: 0; text-decoration: none; }
.brand img { display: block; height: 24px; width: auto; }
.env-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; color: #fdba74; letter-spacing: .05em; margin-right: .5rem; }
.nav-menu { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem; }
.nav-item { display: flex; align-items: center; gap: .4rem; padding: .45rem .75rem; border-radius: 6px; color: var(--nav-text); text-decoration: none; }
.nav-item.is-active { background: var(--accent); color: #fff; }
.nav-group { position: relative; }
.nav-group-title { display: flex; align-items: center; gap: .3rem; padding: .45rem .75rem; border-radius: 6px; cursor: pointer; list-style: none; user-select: none; }
.nav-group-title::-webkit-details-marker { display: none; }
.nav-group-title::after { content: ""; border: solid currentColor; border-width: 0 2px 2px 0; padding: 2px; transform: rotate(45deg); margin: -3px 0 0 .3rem; }
.nav-group-title:hover, .nav-group[open] > .nav-group-title { background: #2c3242; }
.nav-group-title.is-active { box-shadow: inset 0 -3px 0 var(--accent); }
.nav-group > .nav-list { position: absolute; top: calc(100% + .25rem); left: 0; z-index: 110; min-width: 16rem; max-height: 75vh; overflow-y: auto; margin: 0; padding: .35rem; list-style: none; background: var(--nav-bg); border: 1px solid #3a4152; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.nav-group > .nav-list .nav-item { white-space: nowrap; }
.nav-group > .nav-list .nav-badge { margin-left: auto; }
.nav-toggle { display: none; margin-left: auto; font: inherit; padding: .35rem .8rem; border-radius: 6px; background: transparent; color: var(--nav-text); border: 1px solid #6b7280; cursor: pointer; }
.layout { display: block; min-height: calc(100vh - 3rem); }
@media (max-width: 991.98px) {
  .nav-toggle { display: inline-block; }
  .nav-menu { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding: .25rem 0 .5rem; max-height: calc(100vh - 3.5rem); overflow-y: auto; }
  .app-nav.is-open .nav-menu { display: flex; }
  .nav-group > .nav-list { position: static; box-shadow: none; border: 0; padding: 0 0 .25rem .75rem; max-height: none; min-width: 0; }
  .nav-group > .nav-list .nav-item { white-space: normal; }
}
