/* Отзывы App Store — дашборд. Статика без сборки и без внешних ресурсов. */

:root {
  color-scheme: light;

  --surface-1: #fcfcfb;
  --plane: #f9f9f7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);

  /* последовательная шкала (одна тональность, светлое→тёмное) */
  --seq-100: #cde2fb;
  --seq-200: #9ec5f4;
  --seq-250: #86b6ef;
  --seq-350: #5598e7;
  --seq-450: #2a78d6;
  --seq-550: #1c5cab;
  --seq-650: #104281;

  --accent: #2a78d6;

  /* статусы: всегда со значком и подписью, никогда цветом в одиночку */
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --good-text: #006300;

  --radius: 10px;
  --gap: 16px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-1: #1a1a19;
    --plane: #0d0d0d;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --baseline: #383835;
    --border: rgba(255, 255, 255, 0.10);

    --seq-100: #184f95;
    --seq-200: #256abf;
    --seq-250: #256abf;
    --seq-350: #3987e5;
    --seq-450: #5598e7;
    --seq-550: #86b6ef;
    --seq-650: #b7d3f6;

    --accent: #3987e5;
    --good-text: #0ca30c;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1: #1a1a19;
  --plane: #0d0d0d;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --baseline: #383835;
  --border: rgba(255, 255, 255, 0.10);

  --seq-100: #184f95;
  --seq-200: #256abf;
  --seq-250: #256abf;
  --seq-350: #3987e5;
  --seq-450: #5598e7;
  --seq-550: #86b6ef;
  --seq-650: #b7d3f6;

  --accent: #3987e5;
  --good-text: #0ca30c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--plane);
  color: var(--text-primary);
  font: 15px/1.55 var(--font);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); }

/* ---------- каркас ---------- */

header.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  display: flex;
  align-items: baseline;
  gap: 18px;
  flex-wrap: wrap;
}

header.top h1 {
  font-size: 15px;
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
}

header.top nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-left: auto;
}

header.top nav a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 13.5px;
  white-space: nowrap;
}

header.top nav a:hover { background: var(--plane); color: var(--text-primary); }
header.top nav a.on { background: var(--accent); color: #fff; }

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 20px 80px;
}

h2 {
  font-size: 19px;
  margin: 34px 0 6px;
  letter-spacing: -0.01em;
}

h2:first-child { margin-top: 0; }

.sub {
  color: var(--text-secondary);
  font-size: 13.5px;
  margin: 0 0 14px;
  max-width: 78ch;
}

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: var(--gap);
}

/* ---------- оговорки ---------- */

.notice {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-left: 3px solid var(--warning);
  border-radius: var(--radius);
  padding: 13px 16px;
  margin-bottom: var(--gap);
  font-size: 13.5px;
  color: var(--text-secondary);
}

.notice strong { color: var(--text-primary); }
.notice p { margin: 0 0 7px; }
.notice p:last-child { margin-bottom: 0; }
.notice.tight { border-left-color: var(--muted); }

/* ---------- плитки ---------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 10px;
  margin-bottom: var(--gap);
}

.tile {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 15px;
}

.tile .v {
  font-size: 25px;
  font-weight: 640;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.tile .k {
  color: var(--text-secondary);
  font-size: 12.5px;
  margin-top: 3px;
}

.tile .note { color: var(--muted); font-size: 11.5px; margin-top: 2px; }

/* ---------- таблицы ---------- */

.wrap { overflow-x: auto; }

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13.5px;
}

th, td {
  text-align: left;
  padding: 8px 11px;
  border-bottom: 1px solid var(--grid);
  vertical-align: middle;
}

th {
  color: var(--text-secondary);
  font-weight: 550;
  font-size: 12px;
  white-space: nowrap;
  border-bottom: 1px solid var(--baseline);
}

td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--plane); }
td a { text-decoration: none; font-weight: 550; }
td a:hover { text-decoration: underline; }

.chip {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 20px;
  background: var(--plane);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 11.5px;
  white-space: nowrap;
}

/* ---------- распределение оценок ---------- */

.dist {
  display: flex;
  height: 15px;
  border-radius: 4px;
  overflow: hidden;
  min-width: 130px;
  background: var(--grid);
}

.dist span { display: block; }
.dist span + span { box-shadow: -2px 0 0 0 var(--surface-1); }

.legend {
  display: flex;
  gap: 13px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 9px;
  align-items: center;
}

.legend i {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  display: inline-block;
  margin-right: 5px;
  vertical-align: -1px;
}

/* ---------- тепловая карта ---------- */

.heat { border-collapse: separate; border-spacing: 2px; font-size: 13px; }
.heat th { border: 0; padding: 5px 8px; }
.heat td { border: 0; padding: 0; }
.heat td.cat { padding: 5px 9px 5px 0; max-width: 330px; }

.heat td.cat a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
}

.heat td.cat a:hover { color: var(--accent); text-decoration: underline; }

.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  height: 38px;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  border: 0;
  font-family: var(--font);
  width: 100%;
}

.cell.empty {
  background: transparent;
  border: 1px dashed var(--grid);
  color: var(--muted);
  font-weight: 400;
  cursor: default;
}

/* ---------- фильтры ---------- */

.filters {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.filters label {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

select, input[type="search"] {
  font: 13.5px var(--font);
  padding: 6px 9px;
  border-radius: 7px;
  border: 1px solid var(--baseline);
  background: var(--surface-1);
  color: var(--text-primary);
  min-width: 130px;
}

input[type="search"] { min-width: 230px; }
select:focus, input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.count {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--baseline);
  border-radius: 8px;
  overflow: hidden;
}

.seg button {
  font: 13px var(--font);
  padding: 6px 13px;
  background: var(--surface-1);
  color: var(--text-secondary);
  border: 0;
  border-right: 1px solid var(--baseline);
  cursor: pointer;
}

.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: #fff; }

/* ---------- отзывы ---------- */

.review {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 16px;
  margin-bottom: 10px;
}

.review .meta {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 7px;
}

.stars { color: var(--text-primary); font-weight: 600; letter-spacing: 0.5px; }
.review h4 { margin: 0 0 4px; font-size: 14.5px; font-weight: 600; }
.review p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

.orig {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--grid);
}

.orig .lbl {
  font-size: 11.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}

.orig h4, .orig p { color: var(--text-secondary); }
.orig h4 { font-size: 13.5px; }

mark { background: var(--seq-100); color: var(--text-primary); border-radius: 2px; }

.tone { font-size: 11.5px; white-space: nowrap; }
.tone.pos { color: var(--good-text); }
.tone.neg { color: var(--critical); }
.tone.mix { color: var(--text-secondary); }

.empty-state {
  color: var(--text-secondary);
  padding: 26px 0;
  text-align: center;
  font-size: 14px;
}

.more {
  display: block;
  width: 100%;
  padding: 11px;
  font: 13.5px var(--font);
  background: var(--surface-1);
  border: 1px solid var(--baseline);
  border-radius: var(--radius);
  color: var(--accent);
  cursor: pointer;
  margin-top: 4px;
}

.more:hover { background: var(--plane); }

/* ---------- подсказка ---------- */

#tip {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  background: var(--surface-1);
  border: 1px solid var(--baseline);
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 12.5px;
  color: var(--text-primary);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
  max-width: 270px;
  display: none;
  line-height: 1.45;
}

#tip b { font-weight: 600; }
#tip .r { color: var(--text-secondary); }

.foot {
  margin-top: 40px;
  padding-top: 14px;
  border-top: 1px solid var(--grid);
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 640px) {
  main { padding: 16px 13px 60px; }
  .filters { padding: 10px; }
  .count { margin-left: 0; width: 100%; }
  input[type="search"] { min-width: 100%; }
}
