/* Екрани Sales Model. Усі класи з префіксом sm-, щоб не зачепити оболонку.
   Кольори груп перевірені на розрізнення при дальтонізмі й контраст — не міняти. */
:root, [data-theme="light"] { --g-k:#2a78d6; --g-b:#eb6834; --g-n:#1baf7a; }
[data-theme="dark"]          { --g-k:#3987e5; --g-b:#d95926; --g-n:#199e70; }

.sm-app { color: var(--text); }
.sm-app [hidden] { display: none !important; }
.sm-app .num, .sm-app td.num { font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; }
.sm-app button { font-family: inherit; }

/* навігація: два рядки, що гортаються вбік */
.sm-nav { display: flex; align-items: center; gap: 6px; overflow-x: auto; white-space: nowrap; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.sm-nav--objects { border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.sm-obj { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; color: var(--sub); text-decoration: none; font-weight: 600; font-size: var(--fs-lg); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.sm-obj:hover { color: var(--text); }
.sm-obj[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.sm-mine { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; }
.sm-nav--steps { margin-bottom: 20px; padding-bottom: 2px; }
.sm-step { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 999px; padding: 6px 14px 6px 8px; font-size: var(--fs-md); font-weight: 600; cursor: pointer; }
.sm-step[aria-current] { border-color: var(--accent); }
.sm-step[aria-disabled="true"] { color: var(--muted); background: transparent; cursor: default; }
.sm-stepn { display: inline-flex; width: 20px; height: 20px; align-items: center; justify-content: center; border-radius: 50%; background: var(--bg); border: 1px solid var(--border-strong); font-size: var(--fs-xs); }
.sm-arrow { color: var(--muted); }
.sm-step--legacy { margin-left: auto; padding-left: 14px; border-style: dashed; }
.sm-nav--steps .sm-step--legacy { flex-shrink: 0; }

/* шапка вмісту */
.sm-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 14px; }
.sm-h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
.sm-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: var(--fs-sm); color: var(--muted); }
.sm-chip { border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; background: var(--card); color: var(--sub); font-size: var(--fs-sm); }
.sm-chip--warn { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.sm-state { margin: 24px 0; color: var(--sub); font-size: var(--fs-lg); }
.sm-state--err { color: var(--red); }

.sm-sentence { font-size: 20px; line-height: 1.45; margin: 0 0 20px; max-width: 60ch; }
.sm-sentence strong { font-weight: 800; }

/* формула */
.sm-formula { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; margin-bottom: 14px; }
.sm-tile { flex: 1 1 200px; min-width: 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.sm-tile--total { border-color: var(--border-strong); }
.sm-op { align-self: center; font-size: 24px; font-weight: 600; color: var(--muted); line-height: 1; flex: 0 0 auto; }
.sm-tile-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: var(--fs-md); color: var(--sub); }
.sm-tile-main { font-size: 26px; font-weight: 500; letter-spacing: -.02em; margin-top: 2px; white-space: nowrap; }
.sm-tile-sub { font-size: var(--fs-sm); color: var(--sub); }
.sm-cap { margin: 0; font-size: var(--fs-sm); line-height: 1.4; color: var(--muted); }
.sm-note { font-size: var(--fs-sm); color: var(--muted); margin: 10px 0 0; line-height: 1.45; }
.sm-lowdata { margin: 0 0 14px; color: var(--accent); }

.sm-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.sm-dot--k { background: var(--g-k); } .sm-dot--b { background: var(--g-b); } .sm-dot--n { background: var(--g-n); }

.sm-bars { display: flex; align-items: flex-end; gap: 4px; height: 36px; margin: 8px 0 6px; }
.sm-bar { flex: 1 1 0; max-width: 22px; background: var(--muted); opacity: .35; border-radius: 2px 2px 0 0; }
.sm-bar--last { opacity: 1; background: var(--sub); }
.sm-bar--k.sm-bar--last { background: var(--g-k); } .sm-bar--k { background: var(--g-k); }
.sm-bar--b.sm-bar--last { background: var(--g-b); } .sm-bar--b { background: var(--g-b); }
.sm-bar--n.sm-bar--last { background: var(--g-n); } .sm-bar--n { background: var(--g-n); }
.sm-bar:not(.sm-bar--last) { opacity: .35; }

@media (max-width: 760px) {
  .sm-tile { flex-basis: 100%; }
  .sm-op { flex: 1 1 100%; text-align: center; font-size: 20px; }
  .sm-sentence { font-size: 18px; }
}

/* картки, заголовки */
.sm-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; margin-bottom: 16px; }
.sm-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sm-h2 { margin: 0 0 10px; font-size: var(--fs-lg); font-weight: 700; }
.sm-link { background: none; border: 0; padding: 2px 0; color: var(--accent); font-size: var(--fs-md); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.sm-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: var(--fs-sm); color: var(--sub); margin-bottom: 8px; }
.sm-legend-i { display: inline-flex; align-items: center; gap: 6px; }

/* графік */
.sm-svgwrap { position: relative; }
.sm-svg { display: block; width: 100%; height: auto; overflow: visible; }
.sm-grid { stroke: var(--border); stroke-width: 1; }
.sm-base { stroke: var(--border-strong); stroke-width: 1; }
.sm-axis, .sm-xlab, .sm-xcap, .sm-colval { fill: var(--muted); font-size: 11px; font-family: 'JetBrains Mono', monospace; }
.sm-colval { fill: var(--text); font-weight: 500; }
.sm-xcap { font-family: 'Manrope', system-ui, sans-serif; font-size: 10.5px; }
.sm-hit { fill: transparent; }
.sm-seg--k { fill: var(--g-k); } .sm-seg--b { fill: var(--g-b); } .sm-seg--n { fill: var(--g-n); }
.sm-col { outline: none; cursor: default; }
.sm-col:hover .sm-hit, .sm-col:focus .sm-hit { fill: var(--border); }
.sm-col:focus-visible .sm-hit { stroke: var(--accent); stroke-width: 2; }
.sm-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--bg-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 10px; font-size: var(--fs-sm); box-shadow: var(--shadow-2); min-width: 130px; }
.sm-tip-h { font-weight: 700; margin-bottom: 4px; }
.sm-tip-r { display: flex; align-items: center; gap: 6px; color: var(--sub); }
.sm-tip-r b { min-width: 58px; text-align: right; color: var(--text); font-weight: 500; }

/* вкладки */
.sm-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; white-space: nowrap; }
.sm-tab { background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 10px 14px; font-size: var(--fs-lg); font-weight: 600; color: var(--sub); cursor: pointer; }
.sm-tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.sm-lead { margin: 0 0 12px; font-size: var(--fs-lg); }

/* таблиці */
.sm-tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sm-table { border-collapse: collapse; width: 100%; font-size: var(--fs-md); }
.sm-table th { text-align: left; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--border-strong); white-space: nowrap; vertical-align: bottom; }
.sm-table th.num, .sm-table td.num { text-align: right; }
.sm-table td { padding: 8px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
.sm-table td:first-child { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.sm-table tbody tr:last-child td { border-bottom: 0; }
.sm-click { cursor: pointer; }
.sm-click:hover td { background: var(--card-hover); }
.sm-click:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.sm-unit td { background: var(--bg); }
.sm-kind { margin-left: 8px; font-size: var(--fs-xs); color: var(--muted); font-weight: 500; }
.sm-indent { padding-left: 18px; }
.sm-caret { display: inline-block; width: 14px; color: var(--muted); }
.sm-grp { display: inline-flex; align-items: center; gap: 6px; }
.sm-muted { color: var(--muted); }
.sm-up { color: var(--green); } .sm-down { color: var(--red); }
.sm-sharecell { display: inline-flex; align-items: center; justify-content: flex-end; gap: 8px; }
.sm-sharebar { display: inline-block; width: 40px; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.sm-sharebar i { display: block; height: 100%; background: var(--muted); }
.sm-more { margin: 10px 0 0; }
.sm-sleep { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.sm-sleep-t { margin: 0 0 6px; color: var(--sub); line-height: 1.45; }

.sm-foot { color: var(--muted); font-size: var(--fs-sm); line-height: 1.5; margin: 8px 0 24px; }
.sm-foot p { margin: 0 0 4px; }

@media (pointer: coarse), (max-width: 760px) {
  .sm-app button, .sm-app .sm-link { font-size: 16px; }
}
.sm-table--practices th { white-space: normal; }

/* Дерево «хто продає»: підрозділ розгортається; стрілка практики в таблиці фірми */
.sm-caret { display: inline-block; width: 14px; color: var(--muted); font-size: 11px; }
.sm-unit.sm-click { cursor: pointer; }
.sm-go { color: var(--muted); font-size: 16px; }
tr.sm-click:hover .sm-go { color: var(--accent); }
