/*
 * Nysana — кабинет по прототипу «Nysana Кабинет» v5.
 *
 * Палитра, шрифты и радиусы взяты из прототипа, а не выведены заново: макет — это и есть
 * решение о том, как продукт выглядит, и пересказывать его своими значениями значит спорить с
 * ним там, где спора нет.
 *
 * Имена переменных прототипа (--surface, --fg, --muted, --line, --soft) заведены как основные,
 * а прежние (--bg-raised, --text, --text-dim, --border) оставлены псевдонимами: по ним написаны
 * экраны, которых в макете нет — вход, список анализов, админка, вкладки-подробности. Выкинуть
 * их значило бы переписать половину продукта ради одного экрана.
 *
 * Правила, которые были здесь раньше и остаются: табличные цифры, чтобы числа стояли в колонку;
 * один акцент, только на взаимодействие; подпись о провенансе рядом с каждым числом, которое не
 * измерено нами.
 */

:root {
  /* ---- поверхности ---- */
  /*
   * Фон — холодный не-белый из тона акцента.
   *
   * Карточки белые, и на #f4f5f7 их края пропадали: лист сливался с листом, и три колонки
   * читались как одно полотно. Подложка нужна, но тёплая здесь не годится: акцент у нас
   * чернильно-синий, тон около 215°, а персик — около 28°, почти дополнительный к нему. Пара
   * тёплого и холодного на низкой насыщенности не даёт контраста, она даёт муть.
   *
   * Поэтому фон того же тона, что акцент, насыщенность около четырёх процентов — ниже, чем у
   * всего, что на нём лежит, — и светлота на пять процентов ниже карточки. Этого разрыва хватает,
   * чтобы белое отделилось от фона, и не хватает, чтобы фон начал спорить с цифрами.
   */
  --bg: #eceff5;
  --surface: #ffffff;
  --fg: #14171c;
  --muted: #6a717b;
  --line: #e1e4e8;
  --soft: #eff1f3;

  /*
   * Акцент — чернильный, а не электрический синий.
   *
   * Яркая заливка на каждой второй плашке читается как украшение, и экран, где всё подсвечено,
   * перестаёт подсвечивать что-либо. Акцент здесь почти чёрный: он держит кнопку и ссылку, а
   * внимание распределяют размер и положение, а не цвет.
   */
  --accent: #1d2b44;
  --accent-soft: #eceef1;
  /* Заливка полос — графит. Полоса показывает долю, а не настроение. */
  --fill: #39414d;

  /*
   * Смысловые цвета живут в тексте и точках, но не в заливках.
   *
   * Пастельные подложки под каждым ярлыком давали ровно тот вид, ради которого их и ставят, —
   * «тут что-то важное», — одновременно во всех местах сразу. Приглушённый цвет на сером фоне
   * различим не хуже и не превращает отчёт в светофор.
   */
  --good: #1f6b4b;
  --good-soft: #eef2f0;
  --warn: #8a6520;
  --warn-soft: #f3f1ec;
  --bad: #9b332e;
  --bad-soft: #f3eeed;
  /* Отдельная пара под модельные оценки: «посчитано» и «оценено» должны различаться без слов. */
  --est: #5e6570;
  --est-soft: #eff1f3;

  --display: "Geist", "Inter", ui-sans-serif, system-ui, sans-serif;
  --body: "Geist", "Inter", ui-sans-serif, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  color-scheme: light;

  /* ---- псевдонимы для экранов вне макета ---- */
  --bg-frame: var(--bg);
  --bg-raised: var(--surface);
  --bg-sunken: var(--soft);
  --bg-input: var(--surface);
  --border: var(--line);
  --border-strong: #cdd5e0;
  --text: var(--fg);
  --text-dim: var(--muted);
  --text-faint: #8a94a3;
  --accent-dim: var(--accent-soft);
  --mint: var(--good);
  --good-dim: var(--good-soft);
  --warn-dim: var(--warn-soft);
  --bad-dim: var(--bad-soft);
  --sans: var(--body);

  --shadow: 0 1px 2px rgba(18, 23, 34, 0.04), 0 1px 1px rgba(18, 23, 34, 0.03);
  --radius: 14px;
}

* { box-sizing: border-box; }

/* Any rule that sets display beats the browser's [hidden] default, and several below do. This
   puts the attribute back in charge, so hidden means hidden. */
[hidden]:not([hidden="until-found"]) { display: none !important; }

body {
  /*
   * Поверх заливки — повторяющаяся плитка с мотивами подводного городка.
   *
   * Рисунок приглушён до того уровня, где он виден на пустом месте и не спорит с цифрами:
   * фон, который перетягивает внимание, мешает сильнее, чем белое на белом. background-attachment
   * оставлен прокручиваемым — фиксированный фон на длинном отчёте заметно дороже при скролле.
   */
  background: url("/img-reef.svg") repeat, var(--bg);
  background-size: 200px 200px, auto;
  color: var(--fg);
  font-family: var(--body);
  /* Цифры одной ширины везде, а не только в таблицах: на этом экране они стоят в колонку
     практически в каждом блоке, и прыгающая единица видна сразу. */
  font-feature-settings: "tnum" 1, "cv01" 1;
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.021em;
  margin: 0;
  text-wrap: balance;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font: inherit; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/*
 * Экраны вне макета (вход, список анализов, админка, вкладки-подробности) рисуются прямо в
 * #app и берут поля оттуда. Страница отчёта приносит свою сетку во всю ширину и поля снимает.
 */
#app { margin: 0 auto; max-width: 1440px; padding: 18px 20px 48px; }

/*
 * Экраны вне кабинета получают собственную поверхность.
 *
 * Они рисуются прямо в #app, и пока фон был почти белым, это сходило с рук. На подложке с
 * рисунком так нельзя: чёрные цифры ложились на водоросли, а таблица анализов читалась поверх
 * узора. Поверхность возвращает им тот же белый лист, на котором живут карточки кабинета.
 *
 * Правило отрицательное, а не положительное, потому что добавить класс пришлось бы в каждый
 * вид по отдельности, и следующий новый экран снова оказался бы на узоре.
 */
#app:not(:has(> .page)) {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 32px;
  margin-top: 18px;
  padding: 24px 26px 36px;
}

/* Кабинет приносит свою сетку во всю ширину и поля с поверхностью снимает: карточки у него свои. */
#app:has(> .page) { background: none; border: 0; margin: 0 auto; max-width: none; padding: 0; }

/* ---------------------------------------------------------------- cards */

.card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  min-width: 0;
}
.card > h3 {
  margin: 0 0 12px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card > h3 .spacer { flex: 1; }

/*
 * Every card says what it measures and why it is worth reading. Kept visible rather than
 * hidden behind a tooltip: a number whose meaning you have to hover to learn is a number most
 * people will guess at instead.
 */
.card-why {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 8px;
  font-size: 10.5px;
  line-height: 1.45;
}
.card-why dt { color: var(--accent); white-space: nowrap; }
.card-why dd { color: var(--text-faint); margin: 0; }

.grid { display: grid; gap: 12px; margin-bottom: 12px; }
.grid.k2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.k5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid.k6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.grid.lead { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 1fr); }
.grid.split { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }

@media (max-width: 1240px) {
  .grid.k6, .grid.k5, .grid.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.lead, .grid.split, .grid.k3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .grid.k6, .grid.k5, .grid.k4, .grid.k2 { grid-template-columns: minmax(0, 1fr); }
  main { padding: 16px 16px 136px; }
}

/* ---------------------------------------------------------------- kpi */

.kpi-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--text-dim);
}
.kpi-label svg { width: 15px; height: 15px; opacity: 0.9; }
.kpi-value {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  margin: 8px 0 1px;
  line-height: 1.1;
}
.kpi-sub { font-size: 11px; color: var(--text-faint); }
.kpi-spark { margin-top: 10px; height: 38px; }
.kpi-spark svg { display: block; width: 100%; height: 38px; }

/* ---------------------------------------------------------------- score */

.score-row { display: flex; align-items: baseline; gap: 10px; margin: 2px 0 14px; }
.score-value {
  font-size: 46px;
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.score-max { font-size: 15px; color: var(--text-faint); }

.verdict {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 550;
  border: 1px solid transparent;
}
.verdict.strong { background: var(--good-dim); color: var(--good); border-color: #b7e4d5; }
.verdict.good   { background: var(--accent-dim); color: var(--accent); border-color: #c3d7fb; }
.verdict.mixed  { background: var(--warn-dim); color: var(--warn); border-color: #f0dcae; }
.verdict.weak   { background: var(--bad-dim); color: var(--bad); border-color: #f5c9c5; }
.verdict.unknown { background: var(--bg-input); color: var(--text-faint); border-color: var(--border); }

/* A signed figure in a table cell: gains and losses readable without reading the sign. */
.num .good { color: var(--good); }
.num .bad  { color: var(--bad); }
/* A stretch with no observations, stated as a row rather than left as an invisible jump. */
.gap-row td {
  font-size: 11px;
  padding-top: 8px;
  padding-bottom: 8px;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
}

.breakdown { display: flex; flex-direction: column; gap: 9px; }
.breakdown-row { display: grid; grid-template-columns: 1fr auto 86px; gap: 10px; align-items: center; }
.breakdown-row .name { font-size: 12px; color: var(--text-dim); }
/* The component holding the score back, named in the note below the breakdown. */
.breakdown-row.weakest .name { color: var(--text); font-weight: 500; }
.breakdown-row .num {
  font-size: 11.5px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.meter { height: 5px; border-radius: 3px; background: var(--bg-sunken); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.meter.full i { background: var(--good); }
.meter.none i { background: var(--border-strong); }

/* ---------------------------------------------------------------- signals */

.signal-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.signal-row:last-child { border-bottom: none; }
.signal-row .name { flex: 1; color: var(--text-dim); min-width: 0; }
.signal-row .val { font-variant-numeric: tabular-nums; white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; }
.dot.good { background: var(--good); }
.dot.warn { background: var(--warn); }
.dot.bad  { background: var(--bad); }
.dot.none { background: var(--border-strong); }

/* ---------------------------------------------------------------- profile card */

.profile { display: flex; gap: 14px; align-items: flex-start; }
.profile img.pic {
  width: 62px; height: 62px; border-radius: 12px; object-fit: cover;
  background: var(--bg-sunken); flex: 0 0 62px;
}
.profile .facts { min-width: 0; flex: 1; }
.profile h1 {
  font-size: 19px; font-weight: 600; margin: 0 0 6px;
  letter-spacing: -0.02em; display: flex; align-items: center; gap: 7px;
  overflow-wrap: anywhere;
}
.profile .fact {
  display: flex; gap: 7px; font-size: 11.5px; color: var(--text-dim);
  padding: 1.5px 0; align-items: center;
}
.profile .fact b { color: var(--text); font-weight: 550; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- home */

.hero { max-width: 660px; margin: 56px auto 0; }
.hero h1 { font-size: 24px; font-weight: 600; margin: 0 0 4px; letter-spacing: -0.02em; }
.hero p.lede { color: var(--text-dim); margin: 0 0 24px; }

.field { display: block; margin-bottom: 12px; }
.field > label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-bottom: 5px;
}

/* Selecting by type rather than a class means every new input type has to be added here;
   password was the first one to be forgotten, and rendered at the browser's default width. */
input[type="text"], input[type="password"], textarea, select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  padding: 9px 11px;
}
input[type="text"], input[type="password"] { font-family: var(--mono); }
textarea { resize: vertical; min-height: 64px; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.mode-row { display: flex; gap: 8px; margin: 14px 0; flex-wrap: wrap; }
.mode {
  flex: 1;
  min-width: 150px;
  text-align: left;
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
  border-radius: 4px;
  padding: 9px 11px;
  cursor: pointer;
  color: var(--text);
}
.mode strong { display: block; font-size: 13px; font-weight: 600; }
.mode small { color: var(--text-faint); font-size: 11px; }
.mode[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-dim); }

button.primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
}
button.primary:disabled { opacity: 0.5; cursor: default; }
button.ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 6px 11px;
  font-size: 12px;
  cursor: pointer;
}
button.ghost[aria-pressed="true"] { color: var(--text); border-color: var(--accent); }

/* ---------------------------------------------------------------- tables */

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  font-weight: 500;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:hover td { background: var(--bg-raised); }
td.num, th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
td.cap { max-width: 380px; color: var(--text-dim); }

/* ---------------------------------------------------------------- metrics */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.metric { background: var(--bg-raised); padding: 11px 13px; }
.metric .label {
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 5px;
}
.metric .value {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 21px;
  margin-top: 3px;
  letter-spacing: -0.02em;
}
.metric .sub { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

.help {
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  width: 13px;
  height: 13px;
  font-size: 9px;
  line-height: 11px;
  text-align: center;
  color: var(--text-faint);
  cursor: help;
  flex: none;
}

.conf {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 2px;
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  white-space: nowrap;
}
.conf.high { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.conf.medium { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.conf.low, .conf.insufficient_data, .conf.limited_data {
  color: var(--bad);
  border-color: color-mix(in srgb, var(--bad) 40%, transparent);
}

.tag {
  font-family: var(--mono);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 2px;
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  white-space: nowrap;
}
.tag.sponsored { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.tag.organic { color: var(--text-faint); }
.tag.up { color: var(--good); }
.tag.down { color: var(--bad); }
/* A post worth opening by hand: ТЗ P1-5. Carries the border too, because a colour alone is
   not a difference for a reader who cannot see it. */
.tag.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }

/* ---------------------------------------------------------------- sections */

section { margin-top: 28px; }
section > h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  font-weight: 600;
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.head h1 { font-size: 20px; margin: 0; letter-spacing: -0.02em; }
.head .handle { font-family: var(--mono); color: var(--text-dim); font-size: 13px; }
.head .facts { display: flex; gap: 18px; margin-top: 8px; flex-wrap: wrap; }
.head .facts div { font-size: 12px; color: var(--text-dim); }
.head .facts b {
  display: block;
  font-family: var(--mono);
  font-size: 15px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Sits under the topbar rather than at the foot of the screen: it is navigation, and
   navigation the reader has to scroll to find is navigation they will not use. */
.tabs {
  display: flex;
  gap: 2px;
  margin: -4px 0 14px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tabs a {
  padding: 7px 13px;
  font-size: 13px;
  color: var(--text-dim);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }

/* ---------------------------------------------------------------- progress */

.steps { list-style: none; padding: 0; margin: 18px 0; font-family: var(--mono); font-size: 13px; }
.steps li { padding: 5px 0; display: flex; gap: 10px; align-items: baseline; }
.steps .mark { width: 14px; flex: none; }
.steps .DONE .mark { color: var(--good); }
.steps .RUNNING .mark { color: var(--accent); }
.steps .FAILED .mark { color: var(--bad); }
.steps .SKIPPED .mark, .steps .PENDING .mark { color: var(--text-faint); }
.steps .PENDING { color: var(--text-faint); }
.steps .detail { color: var(--text-dim); font-size: 12px; }

.bar { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); transition: width 0.4s ease; }

/* ---------------------------------------------------------------- misc */

.note {
  border-left: 2px solid var(--border-strong);
  padding: 8px 12px;
  color: var(--text-dim);
  font-size: 13px;
  background: var(--bg-raised);
}
.note.error { border-left-color: var(--bad); color: var(--text); }

.report h3 { font-size: 13px; margin: 18px 0 5px; font-weight: 600; }
.report p { margin: 0 0 6px; color: var(--text-dim); max-width: 78ch; }
.report .cites { font-family: var(--mono); font-size: 10px; color: var(--text-faint); }

.chat-log { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.chat-log .q { font-weight: 600; }
.chat-log .a { color: var(--text-dim); max-width: 78ch; }

.muted { color: var(--text-faint); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

svg.chart { width: 100%; height: auto; display: block; }
svg.chart .axis { stroke: var(--border); }
svg.chart .bar-fill { fill: var(--fill); }
svg.chart .bar-muted { fill: var(--border-strong); }
svg.chart text { fill: var(--text-faint); font-family: var(--mono); font-size: 9px; }
svg.chart .line { stroke: var(--accent); fill: none; stroke-width: 1.5; }
svg.chart .marker { stroke: var(--warn); stroke-dasharray: 3 3; }

@media (max-width: 640px) {
  main { padding: 16px; }
  .hero { margin-top: 24px; }
  .head .facts { gap: 12px; }
  td.cap { max-width: 180px; }
}

/* Language switch: two letters in the header, the active one highlighted. */
.lang-switch { display: flex; gap: 2px; }
.lang-switch button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 3px;
  cursor: pointer;
}
.lang-switch button[aria-pressed="true"] { color: var(--text); border-color: var(--accent); }

/* ---------------------------------------------------------------- misc */

/* A control that reads as a link: used where a card reveals its own workings. */
.linky {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 11px;
  color: var(--accent);
  cursor: pointer;
}
.linky:hover { text-decoration: underline; }

.note.warn { border-left-color: var(--warn); }

.tag {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
}

.profile .pic { border: 1px solid var(--border); }

/*
 * The modal came with the browser's default backdrop, which on a light page reads as a smear
 * rather than a dimming. Given a surface and a real backdrop it becomes a dialog.
 */
dialog {
  background: var(--bg-raised);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(18, 23, 34, 0.14);
  padding: 18px 20px;
  max-width: 400px;
  width: calc(100% - 32px);
}
dialog::backdrop { background: rgba(18, 23, 34, 0.32); }

/* ================================================================ кабинет */

/*
 * Раскладка прототипа: верхняя навигация, слева карточка автора с якорями, по центру отчёт,
 * справа ассистент. Правила перенесены из макета почти дословно — там, где значение отличается
 * от макета, рядом стоит причина.
 */

/* ---------------------------------------------------------- верхняя навигация */

.topnav {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topnav .in {
  align-items: center;
  display: flex;
  gap: 18px;
  height: 56px;
  margin: 0 auto;
  max-width: 1440px;
  padding: 0 20px;
}
.logo {
  color: var(--fg);
  font-family: var(--display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.035em;
}
.logo:hover { text-decoration: none; }
.mainnav { display: flex; gap: 4px; }
.mainnav a, .mainnav span {
  border-radius: 8px;
  color: var(--muted);
  font-weight: 500;
  padding: 7px 11px;
  white-space: nowrap;
}
.mainnav a:hover { text-decoration: none; background: var(--soft); color: var(--fg); }
.mainnav .active { background: var(--soft); color: var(--fg); }
/* Пункт из макета, которого ещё нет. Выглядит как то, чем является. */
.mainnav .soon { color: #a7adb8; cursor: default; }
.mainnav .soon::after {
  background: var(--soft);
  border-radius: 999px;
  content: attr(data-soon);
  font-size: 10px;
  margin-left: 6px;
  padding: 1px 6px;
}
.search {
  align-items: center;
  background: var(--soft);
  border-radius: 10px;
  color: var(--muted);
  display: flex;
  flex: 1;
  gap: 8px;
  min-width: 0;
  padding: 7px 12px;
}
.search input {
  background: transparent;
  border: 0;
  color: var(--fg);
  flex: 1;
  font: inherit;
  min-width: 0;
  outline: 0;
}
.bal { color: var(--muted); font-size: 13px; white-space: nowrap; }
.bal b { color: var(--fg); }
.btn {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--fg);
  font-weight: 600;
  padding: 7px 12px;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { color: var(--muted); cursor: default; }
.btn:disabled:hover { border-color: var(--line); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.av {
  background: var(--accent-soft);
  border-radius: 50%;
  color: var(--accent);
  display: grid;
  font-size: 12px;
  font-weight: 700;
  height: 30px;
  place-items: center;
  width: 30px;
}

/* --------------------------------------------------------------- сетка страницы */

.page {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: 260px minmax(0, 1fr) 320px;
  margin: 0 auto;
  max-width: 1440px;
  padding-block: 18px;
  padding-inline: 20px;
}
.rail {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(100vh - 86px);
  overflow-y: auto;
  position: sticky;
  top: 70px;
  /* Полоса прокрутки на тонкой колонке съедает ширину заметнее, чем помогает. */
  scrollbar-width: thin;
}
.cab-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }

.profile-card { padding: 18px; }
.profile-card .ava {
  background: var(--soft);
  border-radius: 50%;
  display: grid;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 600;
  height: 64px;
  object-fit: cover;
  overflow: hidden;
  place-items: center;
  width: 64px;
}
.profile-card .ava img { height: 100%; object-fit: cover; width: 100%; }
.profile-card h2 { font-size: 18px; margin-top: 10px; }
.profile-card .handle { color: var(--muted); font-size: 13px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
/*
 * Плашка кабинета.
 *
 * Свойства перечислены полностью, включая display и white-space, которых в самом правиле
 * могло бы и не быть: выше в этом файле живут ещё два правила .tag от прежних экранов, и
 * nowrap из первого из них держал длинную тему одной строкой, выпуская её за край карточки
 * шириной 260 пикселей. Каскад молчит о таких столкновениях, а экран — нет.
 */
.tag {
  background: var(--soft);
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  display: inline-block;
  font-family: var(--body);
  font-size: 11px;
  line-height: 1.4;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 3px 8px;
  white-space: normal;
}
.kv {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  gap: 8px 12px;
  grid-template-columns: 1fr 1fr;
  margin-top: 14px;
}
.kv b { color: var(--fg); display: block; font-size: 14px; }
.kv .small b { font-size: 12px; overflow-wrap: anywhere; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.acts .btn {
  flex: 1 1 0;
  font-size: 13px;
  line-height: 1.3;
  min-width: 0;
  text-align: center;
}
.acts .btn.primary { flex: 1 1 100%; }

.anchors { padding: 8px; }
.anchors a {
  align-items: center;
  border-radius: 8px;
  color: var(--muted);
  display: flex;
  font-size: 13px;
  justify-content: space-between;
  padding: 9px 10px;
}
.anchors a:hover { text-decoration: none; background: var(--soft); color: var(--fg); }
.anchors a.on { background: var(--soft); color: var(--fg); font-weight: 600; }
.anchors .dot { border-radius: 50%; height: 8px; width: 8px; }
.d-good { background: var(--good); }
.d-warn { background: var(--warn); }
.d-bad { background: var(--bad); }
.d-est { background: var(--est); }

/* ------------------------------------------------------------------- отчёт */

.main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.rolebar { align-items: center; display: flex; flex-wrap: wrap; gap: 12px; }
.rolebar .label { color: var(--muted); font-size: 12px; }
.rolebar .bench-toggle {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 12px;
  gap: 6px;
}
.fresh { color: var(--muted); font-size: 12px; margin-left: auto; }

.seg { background: var(--soft); border-radius: 10px; display: inline-flex; padding: 3px; }
.seg button {
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 600;
  padding: 6px 12px;
}
.seg button.on { background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); color: var(--fg); }

/*
 * Полоса «что важно»: три ссылки на секции, подставленные из метрик отчёта.
 *
 * Она отвечает на вопрос, с которым читатель открыл отчёт, до того, как он начал читать: куда
 * смотреть именно ему. Содержимое приходит из расчёта, а не зашито — иначе это была бы
 * декорация, повторяющая одно и то же на любом аккаунте.
 */
.focus { display: grid; gap: 8px; grid-template-columns: repeat(3, 1fr); margin: 10px 0 2px; }
.focus a {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--fg);
  display: block;
  font-size: 12px;
  padding: 9px 12px;
}
.focus a:hover { border-color: var(--accent); text-decoration: none; }
.focus a b { color: var(--muted); display: block; font-size: 11px; font-weight: 500; margin-bottom: 2px; }

.verdict {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 20px;
}
.status {
  color: var(--good);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.status.w { color: var(--warn); }
.status.n { color: var(--muted); }
.verdict h1 { font-size: 22px; margin-top: 6px; }
.verdict .ai {
  background: var(--soft);
  border-radius: 9px;
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
  padding: 10px 12px;
}
.verdict .ai b { color: var(--fg); }
.verdict p { color: var(--muted); margin: 6px 0 0; max-width: 62ch; }
.why { display: grid; font-size: 13px; gap: 6px 18px; grid-template-columns: 1fr 1fr; margin-top: 12px; }
.why span::before {
  background: var(--good);
  border-radius: 50%;
  content: "";
  display: inline-block;
  height: 7px;
  margin-right: 8px;
  vertical-align: 1px;
  width: 7px;
}
.why span.w::before { background: var(--warn); }

/*
 * Ширина колонки балла ограничена сверху, а не только снизу.
 *
 * Колонка в .verdict — auto, то есть трек тянется по самой длинной строке внутри. Пока под
 * кольцом стояла короткая подпись «Nysana Score · Хорошо», это было незаметно. Подпись про
 * основание балла длиннее заголовка, и без потолка она растягивала правую колонку, загоняя
 * заголовок и AI-сводку в узкий столбец. Потолок заставляет её переноситься.
 */
.score { max-width: 200px; min-width: 130px; text-align: center; }
.score small + small { font-size: 11px; line-height: 1.35; margin-top: 6px; }
.score .ring { height: 110px; margin: 0 auto; position: relative; width: 110px; }
.score .ring svg { height: 100%; width: 100%; }
.score .ring b {
  display: grid;
  font-family: var(--display);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.03em;
  inset: 0;
  place-items: center;
  position: absolute;
}
.score small { color: var(--muted); display: block; font-size: 12px; margin-top: 4px; }

.sec { padding: 20px; }
.sec header { align-items: baseline; display: flex; gap: 12px; justify-content: space-between; margin-bottom: 14px; }
.sec h2 { font-size: 17px; }
.sec header small { color: var(--muted); font-size: 12px; }

.tiles { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile { background: var(--soft); border-radius: 11px; min-width: 0; padding: 12px 14px; }
.tile .l { align-items: center; color: var(--muted); display: flex; font-size: 11px; gap: 6px; justify-content: space-between; }
.tile .v { font-family: var(--display); font-size: 22px; font-weight: 600; letter-spacing: -0.02em; margin-top: 4px; }
.tile .s { color: var(--muted); font-size: 12px; margin-top: 2px; }

.pill {
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 1px 7px;
  white-space: nowrap;
}
.p-good { color: var(--good); }
.p-warn { color: var(--warn); }
.p-bad { color: var(--bad); }
.p-est { color: var(--est); }

/* Провенанс — буква в рамке с подсказкой по наведению: откуда взялось число. */
.prov {
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  cursor: help;
  font-size: 10px;
  padding: 0 4px;
}

.bench {
  background: var(--soft);
  border-radius: 3px;
  height: 6px;
  margin-top: 8px;
  position: relative;
}
.bench i {
  background: var(--fg);
  border: 2px solid var(--surface);
  border-radius: 50%;
  height: 12px;
  position: absolute;
  top: -3px;
  transform: translateX(-50%);
  width: 12px;
}

.two { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.sub-h { font-size: 13px; margin-bottom: 8px; }

.bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { align-items: center; display: grid; font-size: 12px; gap: 8px; grid-template-columns: 110px 1fr 44px; }
.bar-row .tr { background: var(--soft); border-radius: 4px; height: 8px; overflow: hidden; }
.bar-row .tr i { background: var(--fill); display: block; height: 100%; }
.bar-row .n { color: var(--muted); text-align: right; }

.check { display: grid; gap: 8px 16px; grid-template-columns: 1fr 1fr; }
.check > div { align-items: flex-start; display: flex; font-size: 13px; gap: 8px; }
.check .ok { color: var(--good); font-weight: 700; }
.check .no { color: var(--warn); font-weight: 700; }
.check .na { color: var(--muted); font-weight: 700; }
.check small { color: var(--muted); display: block; font-size: 12px; }

.flags { display: flex; flex-wrap: wrap; gap: 6px; }
.flag {
  border: 1px solid var(--line);
  border-left: 3px solid var(--warn);
  border-radius: 6px;
  color: var(--fg);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
}
.flag.ok { border-left-color: var(--good); color: var(--muted); }

/* Пустое состояние — пунктир, а не пустота: «не измерено» видно, и видно почему. */
.empty { border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: 13px; padding: 14px; }

.grid-posts { display: grid; gap: 10px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.post { background: var(--soft); border-radius: 10px; display: block; overflow: hidden; }
.post:hover { text-decoration: none; }
.post .th { aspect-ratio: 9 / 12; background: #d6dade; position: relative; }
.post .th img { display: block; height: 100%; object-fit: cover; width: 100%; }
.post .th b { bottom: 8px; color: #fff; font-family: var(--display); font-size: 13px; font-weight: 600; left: 8px; position: absolute;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
.post .th .ad {
  background: rgba(0, 0, 0, 0.6);
  border-radius: 999px;
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  position: absolute;
  right: 8px;
  top: 8px;
}
.post .m { color: var(--muted); display: flex; font-size: 11px; justify-content: space-between; padding: 8px; }

.posttabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.posttabs button {
  background: var(--soft);
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 11px;
}
.posttabs button.on { background: var(--fg); color: var(--surface); }

.heat { display: grid; font-size: 11px; color: var(--muted); gap: 3px; grid-template-columns: 60px repeat(8, 1fr); }
.heat i { border-radius: 3px; height: 18px; }

.price-grid { display: grid; gap: 10px; grid-template-columns: 1fr 1fr 1fr; }
.sim { display: grid; gap: 10px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sim .c { background: var(--soft); border-radius: 10px; font-size: 12px; padding: 12px; }
.sim .c b { display: block; font-size: 13px; }
.sim .c span { color: var(--muted); }

.cab-card table { border-collapse: collapse; font-size: 13px; width: 100%; }
.cab-card th { border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 600;
  padding: 8px 10px; text-align: left; }
.cab-card td { border-bottom: 1px solid var(--line); padding: 9px 10px; vertical-align: top; }
.tbl { overflow-x: auto; }

/* ---------------------------------------------------------------- ассистент */

.aside {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(100vh - 86px);
  overflow-y: auto;
  position: sticky;
  top: 70px;
  scrollbar-width: thin;
}
.chat { display: flex; flex-direction: column; height: 560px; }
.chat .hd { align-items: center; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between;
  padding: 14px 16px; }
.chat .hd h3 { font-size: 14px; }
.chat .hd small { color: var(--muted); font-size: 11px; }
.msgs { display: flex; flex: 1; flex-direction: column; gap: 10px; overflow: auto; padding: 14px 16px; }
.msg { border-radius: 12px; font-size: 13px; line-height: 1.45; max-width: 92%; padding: 10px 12px; }
.msg.u { align-self: flex-end; background: var(--soft); }
.msg.a { align-self: flex-start; background: var(--soft); border-left: 2px solid var(--accent); color: var(--fg); }
.msg.a b { display: block; margin-bottom: 3px; }
.msg .refs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.msg .refs a {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  font-size: 11px;
  padding: 2px 7px;
}
.msg .offer {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  margin-top: 8px;
  padding: 8px 10px;
}
.msg .offer .btn { margin-top: 6px; width: 100%; }
.sugg { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.sugg button {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  padding: 5px 10px;
}
.sugg button:hover { border-color: var(--accent); color: var(--fg); }
.chat .input { border-top: 1px solid var(--line); display: flex; gap: 8px; padding: 12px 16px; }
.chat .input input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--fg);
  flex: 1;
  font: inherit;
  min-width: 0;
  padding: 8px 10px;
}
.chatnote { color: var(--muted); font-size: 11px; padding: 0 16px 12px; }

.sharecard { padding: 16px; }
.sharecard h3 { font-size: 14px; margin-bottom: 8px; }
.sharecard .prev { border: 1px solid var(--line); border-radius: 10px; font-size: 12px; padding: 12px; }
.sharecard .prev b { display: block; font-family: var(--display); font-size: 16px; font-weight: 600; }
.sharecard .btn { margin-top: 10px; width: 100%; }

.tooltip {
  background: var(--fg);
  border-radius: 6px;
  color: var(--bg);
  display: none;
  font-size: 11px;
  max-width: 260px;
  padding: 6px 8px;
  pointer-events: none;
  position: fixed;
  z-index: 50;
}

@media (max-width: 1180px) {
  .page { grid-template-columns: 240px minmax(0, 1fr); }
  .aside { grid-column: 1 / -1; position: static; }
  .chat { height: 420px; }
}
@media (max-width: 860px) {
  .page { grid-template-columns: 1fr; }
  .rail { position: static; }
  .anchors, .mainnav { display: none; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .two, .price-grid, .check, .why { grid-template-columns: 1fr; }
  .grid-posts { grid-template-columns: repeat(3, 1fr); }
  .sim { grid-template-columns: 1fr 1fr; }
  .verdict { grid-template-columns: 1fr; }
  .score { text-align: left; }
  .score .ring { margin: 0; }
  .topnav .in { gap: 10px; }
}
@media (max-width: 520px) {
  .grid-posts { grid-template-columns: 1fr 1fr; }
  .tiles { grid-template-columns: 1fr; }
  .search { display: none; }
}

/*
 * Слово вместо прочерка.
 *
 * Прочерк в ячейке читается как сломанное число, и из-за этого о нём спрашивают. Там, где
 * отсутствие само по себе ответ — замера не было, поставщик включается позже, — стоит короткое
 * слово. Оно приглушено, чтобы не спорить за внимание с измеренными цифрами рядом.
 */
.await { color: var(--muted); font-family: var(--body); font-size: 12px; font-weight: 500; }

/*
 * Что сделать — отдельной строкой под рассуждением.
 *
 * Совет, набранный тем же текстом, что и объяснение, теряется в нём: читатель дочитывает
 * «почему» и закрывает окно. Здесь он отделён и начинается со стрелки, потому что это
 * единственная строка ответа, после которой нужно что-то сделать.
 */
.msg.a .act {
  border-left: 2px solid var(--accent);
  color: var(--fg);
  display: block;
  font-weight: 500;
  margin-top: 8px;
  padding-left: 10px;
}

/*
 * Ряд «что спросить дальше» под последним ответом.
 *
 * Отделён от самого ответа воздухом и приглушён: это предложение, а не часть сказанного.
 * Ряд живёт только под последним ответом, поэтому вертикальный отступ снизу ему не нужен —
 * за ним сразу поле ввода.
 */
.sugg.next { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }

/*
 * Ожидание ответа и смена роли в разговоре.
 *
 * «Думает» мигает, потому что неподвижная строка на две секунды читается как уже пришедший
 * ответ. Разделитель ролей — линия с подписью: история остаётся, но ответы за ней написаны
 * под другое решение, и подряд их читать нельзя.
 */
.msg.a.thinking { color: var(--muted); font-style: italic; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }

.rolesplit {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 11px;
  gap: 8px;
  margin: 14px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.rolesplit::before, .rolesplit::after { background: var(--line); content: ""; flex: 1; height: 1px; }

/* Кнопка отправки на время ответа гаснет: заблокированная, но неизменная читается как живая. */
#chat-send:disabled { cursor: default; opacity: 0.45; }

/* Длина ролика в подписи карточки: тем же весом, что дата, — это такой же факт о ролике. */
.post .m .len { color: var(--muted); font-weight: 600; }

/*
 * Значок «i» у метрики — тот же, что у провенанса, но другого смысла.
 *
 * Провенанс отвечает «откуда число», подсказка — «что это и хорошо ли». Выглядят одинаково
 * намеренно: читатель уже знает, что маленький кружок у подписи можно навести.
 */
.prov.help { cursor: help; font-style: italic; }
/* Подсказка длиннее провенансной — даём ей перенос строк и ширину под абзац. */
#tip { max-width: 320px; white-space: pre-line; }

/*
 * Печатный вид отчёта (приёмка D1, упрощённый вариант).
 *
 * Делается стилями, а не серверным рендером: headless-браузер в образе — это зависимость,
 * которую надо держать и обновлять, ради того, что умеет каждый браузер. И печатается ровно
 * тот отчёт, который человек видит, так что разойтись они не могут.
 *
 * Уходит всё, что на бумаге не работает: чат (отвечать некому), переключатель роли (роль
 * зафиксирована той, в которой печатали), кнопки, поиск и шапка приложения. Остаются цифры,
 * подписи под ними и провенанс.
 */
@media print {
  /* Фон и рисунок не печатаем: это краска ради краски, и на сером тексте он мешает. */
  body { background: #fff; }
  .mainnav, .search, .rolebar, .acts, .aside, #tip, .focus, .sugg, .posttabs { display: none !important; }
  header.app, .app-header, #balance, .lang { display: none !important; }

  .page { display: block; max-width: none; padding: 0; }
  .rail { position: static; max-height: none; overflow: visible; }

  /*
   * Карточки не рвутся посередине.
   *
   * Секция, разорванная между страницами, теряет заголовок: на второй странице остаются
   * цифры без того, к чему они относятся.
   */
  .cab-card, .tile, .bar-row, table { break-inside: avoid; page-break-inside: avoid; }
  .cab-card { border: 1px solid #ddd; box-shadow: none; margin-bottom: 10px; }

  /* Графики печатаются: это SVG, а не canvas, и в печати они остаются. */
  .chart { max-width: 100%; }

  /* Ссылки на бумаге не нажимаются — печатаем их адресом, иначе чип теряет смысл. */
  .refs a::after { content: ""; }

  a { color: inherit; text-decoration: none; }
  .post { break-inside: avoid; }
}

/*
 * Шапка печатного листа. На экране её нет — там всё это видно в интерфейсе.
 *
 * position: fixed внутри @media print Chrome повторяет на каждой странице, и это единственный
 * способ получить колонтитул без серверного рендера.
 */
.printhead { display: none; }
@media print {
  .printhead {
    border-bottom: 1px solid #ddd;
    display: flex;
    font-size: 10px;
    justify-content: space-between;
    left: 0; right: 0; top: 0;
    padding: 4px 0;
    position: fixed;
  }
  .printhead span { color: #666; }
  .page { padding-top: 22px; }
}

/*
 * Поле «у меня есть цена».
 *
 * Стоит под блоком цены, а не отдельной кнопкой в шапке: вводят его, посмотрев на нашу
 * оценку, и сравнивать удобнее, когда оба числа на одном экране.
 */
.priceform { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; }
.priceform label { color: var(--muted); display: block; font-size: 12px; margin-bottom: 6px; }
.priceform .row { align-items: center; display: flex; gap: 8px; }
.priceform input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  font: inherit;
  max-width: 180px;
  padding: 8px 10px;
}
.priceform .cur { color: var(--muted); }
@media print { .priceform { display: none; } }

/*
 * Страница по публичной ссылке.
 *
 * Правого рельса нет — чат и карточка получателю не положены, — поэтому сетка в две колонки,
 * а не в три. Отдельная ширина, а не растянутая основная: строка, тянущаяся на весь экран,
 * читается хуже, чем та же строка в колонке.
 */
.page.shared { grid-template-columns: 260px minmax(0, 1fr); }
.sharednote, .sharedfoot {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 12px 16px;
}
.sharednote span, .sharedfoot span { color: var(--muted); font-size: 12px; }
.sharedfoot { margin-top: 18px; }
.sharedfoot .btn { white-space: nowrap; }
@media (max-width: 1100px) { .page.shared { grid-template-columns: minmax(0, 1fr); } }

/* Готовая ссылка: поле и копирование рядом, чтобы видеть, что именно отправляешь. */
.sharelink { display: flex; gap: 6px; margin-top: 8px; }
.sharelink input {
  background: var(--soft); border: 1px solid var(--line); border-radius: 8px;
  flex: 1; font-size: 11px; min-width: 0; padding: 6px 8px;
}

/*
 * Хэштег с результатом (этап 9, E5).
 *
 * Цвет только у заметного отклонения: раскрасив все, мы бы сделали светофор из списка тем,
 * где половина отклонений — шум выборки в три ролика.
 */
.tag.up { background: var(--good-soft); color: var(--good); }
.tag.down { background: var(--warn-soft); color: var(--warn); }
.tag[data-t] { cursor: help; }

/*
 * Календарь публикаций (этап 9, E4).
 *
 * Четыре ступени насыщенности, а не градиент: глаз различает «пусто / мало / средне / много»
 * и не различает двадцать оттенков, а лишние ступени создают видимость точности, которой в
 * счёте роликов за день нет.
 */
.calendar { display: grid; font-size: 11px; gap: 3px; color: var(--muted); margin-top: 8px; }
.calendar i { background: var(--soft); border-radius: 3px; display: block; height: 14px; }
.calendar i.l1 { background: var(--accent-soft); }
.calendar i.l2 { background: #c3cbd8; }
.calendar i.l3 { background: var(--fill); }
.calendar span { align-self: center; }

/*
 * Раскрытый ролик (этап 9, E3).
 *
 * Под сеткой, а не поверх неё: модальное окно закрывает контекст, а ролик сравнивают с
 * соседними, и они должны остаться на виду.
 */
.postdetail { background: var(--soft); border-radius: 12px; margin-top: 12px; padding: 14px 16px; }
.postdetail .row { align-items: center; display: flex; justify-content: space-between; margin-bottom: 10px; }
.postdetail .kv { display: grid; gap: 6px 18px; grid-template-columns: repeat(4, 1fr); }
/* Столбики, а не линия: точек четырнадцать, и у каждой есть своё значение под курсором. */
.curve { align-items: flex-end; display: flex; gap: 3px; height: 50px; margin-top: 12px; }
.curve i { background: var(--fill); border-radius: 2px; cursor: help; display: block; flex: 1; opacity: 0.75; }
.curve i:hover { opacity: 1; }
@media (max-width: 700px) { .postdetail .kv { grid-template-columns: repeat(2, 1fr); } }

/*
 * Таблица сравнения (этап 9, E1).
 *
 * Лучшее значение выделено весом, а не цветом: колонок три, и три зелёных пятна в строке
 * читаются как светофор, тогда как выделять нужно одно — то, на чём глаз должен остановиться.
 */
.compare td.best { color: var(--fg); font-weight: 600; }
.compare td:first-child { color: var(--muted); width: 220px; }
.compare th a { color: var(--fg); font-weight: 600; }

/* ------------------------------------------------------------------ YouTube
 * Only what has no TikTok equivalent: a slim banner, the 16:9 video grid, the URL list.
 * Everything else on the board reuses .cab-card, .tiles, .kv, .empty, .note and the rail. */
.page.yt { grid-template-columns: 260px minmax(0, 1fr); }
.yt-banner { border-radius: 14px; display: block; height: 72px; object-fit: cover; width: 100%; }
.yt-desc { font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; white-space: pre-wrap; }
.yt-urls { display: grid; font-size: 13px; gap: 10px; margin-top: 16px; }
.yt-urls span { color: var(--muted); display: block; font-size: 11px; }
.yt-urls b { display: block; font-weight: 500; overflow-wrap: anywhere; }
.yt-grid { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.yt-video { background: var(--soft); border-radius: 10px; min-width: 0; overflow: hidden; }
.yt-video .th { aspect-ratio: 16 / 9; background: #d6dade; position: relative; }
.yt-video .th img { display: block; height: 100%; object-fit: cover; width: 100%; }
.yt-video .len, .yt-video .live {
  background: rgba(0, 0, 0, 0.7);
  border-radius: 4px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 5px;
  position: absolute;
}
.yt-video .len { bottom: 6px; right: 6px; }
.yt-video .live { background: var(--bad); left: 6px; top: 6px; }
.yt-video .m { padding: 10px; }
.yt-video .t {
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--fg);
  display: -webkit-box;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.yt-video a.t:hover { text-decoration: underline; }
.yt-video .s { color: var(--muted); font-size: 11px; margin-top: 4px; }
.yt-video .d { color: var(--muted); font-size: 12px; margin-top: 6px; overflow-wrap: anywhere; }
.yt-links > div { border-bottom: 1px solid var(--line); display: grid; font-size: 13px; gap: 2px; padding: 9px 0; }
.yt-links > div:last-child { border-bottom: 0; }
.yt-links b { font-weight: 600; }
.yt-links a { overflow-wrap: anywhere; }
.yt-grid.shorts { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.yt-short .th { aspect-ratio: 9 / 16; }
.yt-comments article { border-bottom: 1px solid var(--line); padding: 10px 0; }
.yt-comments article:last-child { border-bottom: 0; }
.yt-comments .who { font-size: 12px; font-weight: 600; }
.yt-comments .s { color: var(--muted); font-size: 11px; margin-top: 4px; }
.yt-comments a { overflow-wrap: anywhere; }
.yt-verdict { font-size: 15px; line-height: 1.55; margin: 0; }
.yt-window { display: grid; font-size: 12px; gap: 6px; padding: 12px; }
.yt-window select { font: inherit; padding: 6px 8px; width: 100%; }
.yt-price { margin-bottom: 12px; }
.yt-price label { color: var(--muted); display: grid; font-size: 12px; gap: 6px; }
.yt-price input {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--fg);
  font: inherit;
  padding: 8px 10px;
  width: 180px;
}
@media (max-width: 860px) {
  .page.yt { grid-template-columns: minmax(0, 1fr); }
  .yt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .yt-grid.shorts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .yt-grid, .yt-grid.shorts { grid-template-columns: minmax(0, 1fr); }
}
/* Tier bar: Live · Deep · Full with the dates of the two layers */
.tierbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 10px; }
.tierbar .seg button[data-upgrade] { color: var(--accent); }
.tierbar .seg button { cursor: pointer; }
.tierbar .notice-warn { flex-basis: 100%; font-size: 12px; color: var(--warn, #b45309); }

/* The page of what the next tier adds exists on paper only */
.nexttier { display: none; }
@media print {
  .nexttier { display: block; break-before: page; page-break-before: always; padding-top: 24px; }
  .nexttier h2 { font-size: 16px; margin: 0 0 8px; }
  .nexttier p { color: #444; font-size: 12px; line-height: 1.5; }
  .tierbar { display: none !important; }
}

/* A long value (an e-mail, a link) wraps inside the profile card instead of running out of it */
.kv > div, .kv b { min-width: 0; overflow-wrap: anywhere; }

/* Tier mood: each level of the report has its own pastel light, so switching Live → Deep → Full feels like
   the hour of the day changing, not a theme flip. Washes are faint; text and data colours are untouched. */
.page[data-tier] { --t1: #e4f3ec; --t2: #e3eefa; --tline: #cfe6dc; --tink: #2f6b57; }
.page[data-tier="deep"] { --t1: #ece6f7; --t2: #fbe9e1; --tline: #ddd3ef; --tink: #5a4a8a; }
.page[data-tier="full"] { --t1: #fce7ea; --t2: #fdf1d6; --tline: #f2d9c9; --tink: #9a5a3c; }

.page[data-tier] .main .cab-card.sec {
  background: linear-gradient(135deg, var(--t1) 0%, color-mix(in srgb, var(--t2) 55%, var(--surface)) 38%, var(--surface) 78%);
  border-color: var(--tline);
  animation: tier-in 0.45s cubic-bezier(.2, .7, .2, 1) both;
}
.page[data-tier] .main .cab-card.sec:nth-of-type(2) { animation-delay: 0.05s; }
.page[data-tier] .main .cab-card.sec:nth-of-type(3) { animation-delay: 0.10s; }
.page[data-tier] .main .cab-card.sec:nth-of-type(4) { animation-delay: 0.15s; }
.page[data-tier] .main .cab-card.sec:nth-of-type(n+5) { animation-delay: 0.2s; }
.page[data-tier] .rail .profile-card { background: linear-gradient(180deg, var(--t1), var(--surface) 70%); border-color: var(--tline); }
.page[data-tier] .tile { background: color-mix(in srgb, var(--t1) 45%, var(--surface)); }
.page[data-tier] .tierbar .seg button.on { background: linear-gradient(135deg, var(--t1), var(--t2)); color: var(--tink); }

@keyframes tier-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .page[data-tier] .main .cab-card.sec { animation: none; } }
@media print {
  .page[data-tier] .main .cab-card.sec, .page[data-tier] .rail .profile-card { background: #fff; animation: none; }
}
