/* 09-analytics.css — analytics cockpit, provider status table.
   Part of the former single site.css. These files are ORDER-DEPENDENT: they are linked in
   numeric order in _Layout.cshtml and later rules still override earlier ones exactly as they
   did in the one big file. Do not reorder the <link> tags. */
/* ===== Analytics decision cockpit ===== */
.analytics-page {
  max-width: 100%;
}

.analytics-page--table {
  display: grid;
  gap: 8px;
}

/* One column no wider than the page: an implicit track took its children's min-content, 454 px at 390 (task 080). */
.analytics-table-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
}

.analytics-empty-filter {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 190px;
  border: 1px dashed var(--border);
  border-radius: 18px;
  background: var(--surface);
  padding: 30px 18px;
}

.analytics-empty-filter strong {
  color: var(--text);
  font-size: 1rem;
}

.analytics-empty-filter p {
  max-width: 720px;
  margin: 0;
  line-height: 1.45;
}

.analytics-empty-filter__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.analytics-table-wrap--card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
  overflow-x: auto;
  overflow-y: visible;
}

/* «Показати ще» lands here (task 072): clear of the sticky .app-header (73 px at 1440 px). */
#analytics-more-start {
  scroll-margin-top: 96px;
}

/* «Показати ще N» under the first 100 rows (task 072). */
.analytics-more-rows {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  padding: 12px 0 4px;
  color: var(--muted);
}

.analytics-table-wrap--analysis {
  min-height: 420px;
  overflow-x: auto;
  overflow-y: visible;
}

.deal { display: inline-flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }

.analytics-minifig {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  max-width: 128px;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  line-height: 1.08;
}

.analytics-minifig strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.78rem;
  font-weight: 900;
  background: var(--surface-2);
}

.analytics-minifig span,
.analytics-minifig small {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-minifig span {
  font-size: 0.76rem;
  font-weight: 800;
}

.analytics-minifig small {
  color: var(--muted);
  font-size: 0.68rem;
}

.analytics-minifig--strong strong {
  color: #6d28d9;
  background: #f3e8ff;
  border-color: #d8b4fe;
}

.analytics-minifig--edge strong {
  color: var(--up);
  background: var(--up-bg);
  border-color: color-mix(in srgb, var(--up) 35%, var(--surface-1));
}

.analytics-verdict--buy {
  color: var(--up);
  background: var(--up-bg);
  border-color: color-mix(in srgb, var(--up) 35%, var(--surface-1));
}

.analytics-verdict--sell {
  color: var(--down);
  background: var(--down-bg);
  border-color: #f3b0a6;
}

.analytics-verdict--hold {
  color: var(--info);
  background: var(--info-bg);
  border-color: color-mix(in srgb, var(--info) 35%, var(--surface-1));
}

.analytics-table--investor {
  --analytics-row-card-height: 104px;
  table-layout: fixed;
  min-width: 1760px;
  border-collapse: separate;
  border-spacing: 0;
}

.analytics-table--investor caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.analytics-table--investor th,
.analytics-table--investor td {
  padding-inline: 6px;
  white-space: normal;
  vertical-align: middle;
}

.analytics-table--investor td.num {
  text-align: left;
}

.analytics-table--investor th {
  position: sticky;
  top: 0;
}

.analytics-table--investor th:first-child,
.analytics-table--investor td:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--surface);
  box-shadow: 1px 0 0 var(--border);
}

.analytics-table--investor thead th:first-child {
  z-index: 5;
  background: var(--surface-2);
}

.analytics-table--investor tbody tr {
  transition: background .12s ease, box-shadow .12s ease;
}

.analytics-table--investor tbody tr:hover {
  background: var(--surface);
  box-shadow: inset 0 1px 0 #dbeafe, inset 0 -1px 0 #dbeafe;
}

.analytics-table--investor tbody tr:hover .analytics-set__name {
  color: var(--accent-text);
}

.analytics-table--investor .analytics-set {
  gap: 12px;
  align-items: center;
}

.analytics-table--investor .analytics-set__thumb {
  flex-basis: 96px;
  width: 96px;
  height: 76px;
  border-radius: 12px;
}

.analytics-table--investor .analytics-set__name {
  font-size: 0.88rem;
}

.analytics-table--investor th:nth-child(1),
.analytics-table--investor td:nth-child(1) { width: 15%; }
.analytics-table--investor th:nth-child(2),
.analytics-table--investor td:nth-child(2) { width: 14%; }
.analytics-table--investor th:nth-child(3),
.analytics-table--investor td:nth-child(3) { width: 9%; }
.analytics-table--investor th:nth-child(4),
.analytics-table--investor td:nth-child(4) { width: 13%; }
.analytics-table--investor th:nth-child(5),
.analytics-table--investor td:nth-child(5) { width: 10%; }
.analytics-table--investor th:nth-child(6),
.analytics-table--investor td:nth-child(6) { width: 11%; }
.analytics-table--investor th:nth-child(7),
.analytics-table--investor td:nth-child(7) { width: 11%; }
.analytics-table--investor th:nth-child(8),
.analytics-table--investor td:nth-child(8) { width: 10%; }
/* The deal score (task 147): the ninth column's 7 % came from the set, the decision, the price, the history and the trend. */
.analytics-table--investor th:nth-child(9),
.analytics-table--investor td:nth-child(9) { width: 7%; }

.analytics-table--investor thead th {
  z-index: 2;
  background: var(--surface-2);
  box-shadow: 0 1px 0 var(--border);
}

.analytics-table-head--market {
  margin-top: 12px;
}

.analytics-table-head--table-only {
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
  margin-top: 0;
}

.analytics-table-head--table-only h1 {
  margin: 1px 0 0;
  font-size: clamp(1.05rem, 1.45vw, 1.35rem);
  line-height: 1;
}

.analytics-table-head--table-only p {
  display: none;
}

.analytics-table-head--table-only .analytics-table-head__kicker {
  margin-left: auto;
  font-size: 0.60rem;
  line-height: 1;
  text-align: right;
}

.analytics-table-filters {
  display: grid;
  /* The first column is every page's search field (task 186): wide enough for «Набори: номер або назва». */
  grid-template-columns: minmax(15rem, 1.6fr) repeat(6, minmax(104px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin: 0 0 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
}

.analytics-table-filters > label,
.analytics-filter-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.analytics-table-filters > label > span,
.analytics-filter-field > span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.analytics-table-filters .form-control,
.analytics-table-filters .form-select {
  min-height: 34px;
  border-color: var(--border);
  border-radius: 9px;
  font-size: 0.78rem;
}

.analytics-multiselect {
  position: relative;
  min-width: 0;
}

.analytics-multiselect summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 0.78rem;
  line-height: 1.2;
  list-style: none;
  overflow: hidden;
  padding: 7px 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-multiselect summary::-webkit-details-marker {
  display: none;
}

.analytics-multiselect summary::after {
  color: var(--text-muted);
  content: "▾";
  flex: 0 0 auto;
  font-size: 0.75rem;
}

.analytics-multiselect[open] summary {
  border-color: color-mix(in srgb, var(--info) 35%, var(--surface-1));
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
}

.analytics-multiselect[open] summary::after {
  content: "▴";
}

.analytics-multiselect__menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  display: grid;
  gap: 3px;
  width: max(100%, 220px);
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
  padding: 8px;
}

/* Right-edge dropdowns anchor their menu to the right so it opens inward and never
   overflows the viewport (which would add a horizontal page scrollbar). */
.analytics-multiselect--end .analytics-multiselect__menu {
  left: auto;
  right: 0;
}

.analytics-multiselect__menu label {
  display: flex;
  gap: 8px;
  align-items: center;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.80rem;
  line-height: 1.2;
  padding: 7px 8px;
}

.analytics-multiselect__menu label:hover {
  background: var(--surface-2);
}

.analytics-multiselect__menu input {
  flex: 0 0 auto;
  margin: 0;
}

.analytics-multiselect__menu span {
  min-width: 0;
}

/* Per-option match count so a legitimately empty facet (e.g. 0 buy candidates) reads as "0", not "broken". */
.analytics-multiselect__count {
  flex: 0 0 auto;
  margin-left: auto;
  min-width: 1.5em;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.analytics-multiselect__opt--empty {
  opacity: 0.5;
}

.analytics-multiselect__opt--empty .analytics-multiselect__count {
  background: transparent;
  color: var(--muted);
}

.analytics-table-filters__actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  white-space: nowrap;
}

.analytics-sort-link {
  display: inline-flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
  width: 100%;
  color: inherit;
  text-decoration: none;
}

.analytics-table--investor th.num .analytics-sort-link {
  justify-content: flex-end;
}

.analytics-sort-text {
  display: grid;
  gap: 1px;
  min-width: 0;
  line-height: 1.1;
}

.analytics-sort-text small {
  color: var(--muted);
  font-size: 0.63rem;
  font-weight: 800;
  text-transform: none;
}

.analytics-sort-link .analytics-sort-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--info-bg);
  color: var(--text-muted);
  font-size: 0.68rem;
  line-height: 1;
}

.analytics-sort-link:hover,
.analytics-sort-link.active {
  color: var(--accent-text);
}

.analytics-sort-link.active .analytics-sort-icon {
  background: var(--accent);
  color: var(--accent-contrast);
}

.analytics-investor-row {
  background: var(--surface);
}

.analytics-investor-row td:first-child {
  border-left: 4px solid transparent;
}

.analytics-investor-row--buy td:first-child { border-left-color: #0f7a41; }
.analytics-investor-row--watch td:first-child { border-left-color: #24589e; }
.analytics-investor-row--exit td:first-child { border-left-color: #b23120; }
.analytics-investor-row--wait td:first-child { border-left-color: #0e7490; }
.analytics-investor-row--verify td:first-child { border-left-color: #7c3aed; }
.analytics-investor-row--avoid td:first-child { border-left-color: #92400e; }
.analytics-investor-row--research td:first-child { border-left-color: #f59e0b; }

.analytics-market-cell {
  text-align: left;
}

.analytics-market-buybox {
  display: grid;
  grid-template-columns: repeat(2, minmax(92px, 1fr));
  gap: 6px;
  min-width: 206px;
  width: 100%;
  height: var(--analytics-row-card-height);
  font-variant-numeric: tabular-nums;
  text-align: left;
}

.analytics-market-price-card {
  box-sizing: border-box;
  display: grid;
  gap: 2px;
  height: 100%;
  min-width: 0;
  align-content: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: inherit;
  padding: 7px 8px;
  text-decoration: none;
}

.analytics-market-price-card > span {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.analytics-market-price-card strong {
  overflow: hidden;
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.08;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-market-price-card small,
.analytics-market-price-card em {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.64rem;
  font-style: normal;
  font-weight: 800;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-market-price-card em {
  margin-top: 1px;
}

.analytics-market-delta {
  display: grid;
  gap: 3px;
  margin-top: 2px;
}

.analytics-market-delta__bar {
  position: relative;
  display: block;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #16a34a 0%, var(--surface-3) 50%, #ef4444 100%);
}

.analytics-market-delta__bar::after {
  position: absolute;
  top: -2px;
  bottom: -2px;
  left: 50%;
  width: 2px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.28);
  content: "";
  transform: translateX(-50%);
}

.analytics-market-delta__bar i {
  position: absolute;
  top: 50%;
  z-index: 1;
  width: 12px;
  height: 12px;
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: #334155;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.24);
  transform: translate(-50%, -50%);
}

.analytics-market-delta em {
  margin-top: 0;
  text-align: center;
}

.analytics-market-price-card--buy:hover strong {
  text-decoration: underline;
}

.analytics-market-price-card--market {
  border-color: color-mix(in srgb, var(--info) 35%, var(--surface-1));
  background: var(--info-bg);
}

.analytics-market-price-card--good {
  border-color: color-mix(in srgb, var(--up) 35%, var(--surface-1));
  background: var(--up-bg);
}

.analytics-market-price-card--good strong,
.analytics-market-price-card--good em {
  color: var(--up);
}

.analytics-market-price-card--watch {
  border-color: color-mix(in srgb, var(--warn) 35%, var(--surface-1));
  background: var(--warn-bg);
}

.analytics-market-price-card--watch strong,
.analytics-market-price-card--watch em {
  color: var(--warn);
}

.analytics-market-price-card--bad {
  border-color: #f3b0a6;
  background: var(--down-bg);
}

.analytics-market-price-card--bad strong,
.analytics-market-price-card--bad em {
  color: var(--down);
}

.analytics-market-price-card--empty {
  border-style: dashed;
}

.analytics-market-action-cell,
.analytics-market-ref {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  min-width: 112px;
}

.analytics-market-action-cell {
  align-items: flex-start;
}

.analytics-market-action-cell--analysis {
  height: var(--analytics-row-card-height);
  min-width: 190px;
  width: 100%;
  justify-content: center;
}

.analytics-lifecycle-cell {
  box-sizing: border-box;
  display: inline-flex;
  flex-direction: column;
  gap: 7px;
  height: var(--analytics-row-card-height);
  min-width: 146px;
  width: 100%;
  justify-content: space-between;
  border-left: 3px solid var(--border);
  padding-left: 9px;
}

.analytics-lifecycle-cell__head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.analytics-lifecycle-cell strong {
  font-size: 0.86rem;
  line-height: 1.15;
}

.analytics-lifecycle-cell__head b {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--surface-2);
  padding: 3px 7px;
  color: var(--text);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}

.analytics-lifecycle-cell small {
  color: var(--muted);
  font-size: 0.70rem;
  font-weight: 800;
  line-height: 1.2;
}

.analytics-lifecycle--retail { border-left-color: #24589e; }
.analytics-lifecycle--retiring { border-left-color: #f59e0b; }
.analytics-lifecycle--just-retired { border-left-color: #b45309; }
.analytics-lifecycle--growth { border-left-color: #0f7a41; }
.analytics-lifecycle--mature { border-left-color: #64748b; }
.analytics-lifecycle--unknown { border-left-color: var(--border); }

.analytics-lifecycle-timeline {
  display: grid;
  gap: 5px;
}

.analytics-lifecycle-timeline__status {
  justify-self: start;
  max-width: 100%;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  padding: 2px 7px;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-lifecycle-timeline__track {
  position: relative;
  display: block;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: visible;
}

.analytics-lifecycle-timeline__fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #60a5fa, #f59e0b);
}

.analytics-lifecycle-timeline__marker {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: #334155;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.24);
  transform: translate(-50%, -50%);
}

.analytics-lifecycle-timeline__labels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: center;
}

.analytics-lifecycle-timeline__labels small {
  min-width: 0;
  white-space: nowrap;
}

.analytics-lifecycle-timeline__labels small:last-child {
  text-align: right;
}

.analytics-lifecycle--retail .analytics-lifecycle-timeline__fill { background: linear-gradient(90deg, #60a5fa, #24589e); }
.analytics-lifecycle--retiring .analytics-lifecycle-timeline__fill { background: linear-gradient(90deg, #60a5fa, #f59e0b); }
.analytics-lifecycle--just-retired .analytics-lifecycle-timeline__fill { background: linear-gradient(90deg, #60a5fa, #b45309); }
.analytics-lifecycle--growth .analytics-lifecycle-timeline__fill { background: linear-gradient(90deg, #60a5fa, #0f7a41); }
.analytics-lifecycle--mature .analytics-lifecycle-timeline__fill { background: linear-gradient(90deg, #94a3b8, #64748b); }

.analytics-lifecycle--post-retired .analytics-lifecycle-timeline__track {
  background: linear-gradient(90deg, var(--up-bg) 0%, var(--up-bg) 55%, #86efac 100%);
}

.analytics-lifecycle--post-retired .analytics-lifecycle-timeline__fill {
  background: linear-gradient(90deg, #22c55e, #0f7a41);
}

.analytics-lifecycle--post-retired .analytics-lifecycle-timeline__status {
  background: var(--up-bg);
  color: var(--up);
}

.analytics-market-action-cell strong {
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}

.analytics-market-action-cell small,
.analytics-market-ref small {
  color: var(--muted);
  font-size: 0.70rem;
  font-weight: 800;
  line-height: 1.2;
}

.analytics-decision-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  max-width: 100%;
}

.analytics-opp-chip {
  min-height: 18px;
  padding: 0 6px;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 800;
  white-space: nowrap;
}

.analytics-market-action-cell--analysis > span {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.70rem;
  font-weight: 700;
  line-height: 1.25;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.analytics-market-ref {
  box-sizing: border-box;
  align-items: flex-end;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  height: var(--analytics-row-card-height);
  width: 100%;
  justify-content: center;
  padding: 7px 8px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.analytics-market-ref strong {
  color: var(--text);
  font-size: 0.90rem;
  line-height: 1.1;
}

.analytics-market-ref span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1.15;
}

.analytics-ref-scale {
  position: relative;
  display: block;
  width: 100%;
  height: 8px;
  overflow: visible;
  border-radius: 999px;
  background: var(--surface-3);
}

.analytics-ref-scale-meta,
.analytics-ref-scale-labels {
  display: grid;
  width: 100%;
  gap: 4px;
}

.analytics-ref-scale-meta {
  grid-template-columns: 1fr 1fr;
}

.analytics-ref-scale-meta small,
.analytics-ref-scale-labels small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 900;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-ref-scale-meta small:first-child {
  color: var(--text);
}

.analytics-ref-scale-meta small:last-child {
  text-align: right;
}

.analytics-ref-scale-labels {
  grid-template-columns: 1fr auto 1fr;
}

.analytics-ref-scale-labels small:nth-child(2) {
  color: var(--text);
  text-align: center;
}

.analytics-ref-scale-labels small:last-child {
  text-align: right;
}

.analytics-ref-scale-labels--floor small:nth-child(2) {
  color: var(--up);
}

.analytics-ref-scale--msrp {
  background: linear-gradient(90deg, #16a34a 0%, #eab308 66%, #ef4444 100%);
}

.analytics-ref-scale--floor {
  background: linear-gradient(90deg, var(--info-bg) 0%, var(--info-bg) 41.7%, var(--up-bg) 41.7%, var(--up-bg) 54.2%, var(--down-bg) 54.2%, var(--down-bg) 100%);
}

.analytics-ref-scale--history {
  background: linear-gradient(90deg, #16a34a 0%, #eab308 52%, #ef4444 100%);
}

.analytics-ref-scale__reference {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.36);
  transform: translateX(-50%);
}

.analytics-ref-scale__zone {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: inherit;
  background: #16a34a;
  box-shadow: inset 0 0 0 1px rgba(15, 122, 65, 0.18);
}

.analytics-ref-scale__marker {
  position: absolute;
  top: 50%;
  z-index: 1;
  width: 12px;
  height: 12px;
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: #334155;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.24);
  transform: translate(-50%, -50%);
}

.analytics-trend-card {
  box-sizing: border-box;
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  height: var(--analytics-row-card-height);
  min-width: 138px;
  width: 100%;
  justify-content: space-between;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-2);
  padding: 7px 8px;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.analytics-trend-card__main {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px;
  align-items: center;
}

.analytics-trend-card__arrow {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 1000;
  line-height: 1;
}

.analytics-trend-card__metric {
  display: inline-flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.analytics-trend-card__metric small {
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: .05em;
  line-height: 1;
  text-transform: uppercase;
}

.analytics-trend-card__metric strong {
  color: var(--text);
  font-size: 0.90rem;
  line-height: 1.05;
  white-space: nowrap;
}

.analytics-trend-card__label {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.70rem;
  font-weight: 900;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-trend-card__forecast {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 4px;
  align-items: center;
  border-radius: 9px;
  background: var(--surface);
  padding: 4px 5px;
}

.analytics-trend-card__forecast span {
  font-size: 0.82rem;
  font-weight: 1000;
  line-height: 1;
}

.analytics-trend-card__forecast small {
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 1000;
  letter-spacing: .04em;
  line-height: 1;
}

.analytics-trend-card__forecast strong {
  overflow: hidden;
  color: var(--text);
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1.1;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-trend-card--strong-up,
.analytics-trend-card--up {
  border-color: color-mix(in srgb, var(--up) 35%, var(--surface-1));
  background: var(--up-bg);
}

.analytics-trend-card--strong-up .analytics-trend-card__arrow,
.analytics-trend-card--up .analytics-trend-card__arrow {
  background: var(--up-bg);
  color: var(--up);
}

.analytics-trend-card--strong-up .analytics-trend-card__metric strong,
.analytics-trend-card--up .analytics-trend-card__metric strong,
.analytics-trend-card__forecast--up span {
  color: var(--up);
}

.analytics-trend-card--strong-down,
.analytics-trend-card--down {
  border-color: #f3b0a6;
  background: var(--down-bg);
}

.analytics-trend-card--strong-down .analytics-trend-card__arrow,
.analytics-trend-card--down .analytics-trend-card__arrow {
  background: var(--down-bg);
  color: var(--down);
}

.analytics-trend-card--strong-down .analytics-trend-card__metric strong,
.analytics-trend-card--down .analytics-trend-card__metric strong,
.analytics-trend-card__forecast--down span {
  color: var(--down);
}

.analytics-trend-card--flat {
  border-color: color-mix(in srgb, var(--warn) 35%, var(--surface-1));
  background: var(--warn-bg);
}

.analytics-trend-card--flat .analytics-trend-card__arrow,
.analytics-trend-card__forecast--flat span {
  color: var(--warn);
}

.analytics-trend-card--empty {
  border-style: dashed;
  color: var(--muted);
}

.analytics-market-ref--good {
  border-color: color-mix(in srgb, var(--up) 35%, var(--surface-1));
  background: var(--up-bg);
}

.analytics-market-ref--good strong {
  color: var(--up);
}

.analytics-market-ref--watch {
  border-color: color-mix(in srgb, var(--warn) 35%, var(--surface-1));
  background: var(--warn-bg);
}

.analytics-market-ref--watch strong {
  color: var(--warn);
}

.analytics-market-ref--bad {
  border-color: #f3b0a6;
  background: var(--down-bg);
}

.analytics-market-ref--bad strong {
  color: var(--down);
}

.analytics-market-ref--empty {
  border-style: dashed;
  color: var(--muted);
  background: var(--surface-2);
}

.analytics-table-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin: 4px 0 10px;
}

.analytics-table-head__kicker {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.analytics-table-head h2 {
  margin: 2px 0 0;
  font-size: 1.08rem;
}

.analytics-table-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

@media (max-width: 720px) {
  .analytics-table-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .analytics-table-filters {
    grid-template-columns: 1fr;
  }

  .analytics-table-filters__actions {
    justify-content: flex-start;
  }
}

/* Task 059: «Точність прогнозу» under the market table. */
.forecast-accuracy {
    margin-top: 24px;
    padding: 16px;
    border: 1px solid var(--border, #d9e0ea);
    border-radius: 12px;
    background: var(--surface);
}

.forecast-accuracy h2 {
    margin: 0 0 8px;
    font-size: 1.1rem;
}

.forecast-accuracy__note {
    margin: 0 0 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* The accuracy tables scroll inside their block, not the page: they made /Analytics 1 520 px wide at 1 440 and
   642 at 390 (task 080). */
.forecast-accuracy__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
    gap: 16px;
    margin-bottom: 12px;
    overflow-x: auto;
}

.forecast-accuracy__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
    font-variant-numeric: tabular-nums;
}

.forecast-accuracy__table caption {
    caption-side: top;
    text-align: left;
    font-weight: 600;
    padding-bottom: 6px;
    color: var(--text);
}

.forecast-accuracy__table th,
.forecast-accuracy__table td {
    padding: 4px 8px;
    border-bottom: 1px solid var(--border);
    text-align: right;
    white-space: nowrap;
}

.forecast-accuracy__table th:first-child {
    text-align: left;
}

.forecast-accuracy__row--worse td:nth-child(2) {
    color: var(--warn);
    font-weight: 600;
}

.forecast-accuracy__n {
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* The phone and the tablet (task 105), ≤ 900 px: the search and «Фільтри (N)» on one line, the six filters and
   «Застосувати» in the sheet, each multiselect's list open in the sheet's flow (an absolute list would be clipped by the
   sheet's scroll); the table scrolls inside its wrap, its set column (held at the left since before) 150 px. At 768 the filters' eight
   columns made the page 994 px wide. */
@media (max-width: 900px) {
  .analytics-table-filters {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }

  .analytics-table-filters .ui-filters .analytics-filter-field,
  .analytics-table-filters .ui-filters .analytics-table-filters__actions {
    min-width: 0;
  }

  .ui-filters .analytics-multiselect summary {
    min-height: var(--touch);
  }

  .ui-filters .analytics-multiselect__menu {
    position: static;
    width: 100%;
    max-height: none;
    margin-top: 6px;
    box-shadow: none;
  }

  .ui-filters .analytics-multiselect__menu label {
    min-height: var(--touch);
  }

  .ui-filters .analytics-table-filters__actions {
    display: flex;
    gap: var(--space-2);
  }

  .ui-filters .analytics-table-filters__actions .btn {
    flex: 1 1 auto;
  }

  .analytics-table-filters .form-control {
    min-height: var(--touch);
  }

  /* The set column is already held at the left; on a phone it is 150 px with a small picture, not 17 % of 1 760. */
  .analytics-table--investor {
    min-width: 1400px;
  }

  .analytics-table--investor th:nth-child(1),
  .analytics-table--investor td:nth-child(1) {
    width: 150px;
  }

  .analytics-table--investor .analytics-set {
    gap: 8px;
  }

  .analytics-table--investor .analytics-set__thumb {
    flex-basis: 40px;
    width: 40px;
    height: 34px;
    border-radius: 8px;
  }
}
