/* Стили приложения в духе main.pdf, поверх переменных и базовых блоков main.css */

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
}

.brand-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.app {
  min-height: calc(100vh - 80px);
  padding: var(--space-5) 0 var(--space-8);
  background: var(--header-bg);
}

.app .container {
  max-width: var(--container-md);
}

.app-bar {
  display: none; ///flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.app .status {
  margin: 0;
  width: 100%;
  color: var(--text-muted);
  font-size: 13px;
}

.app .tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.app .tabs button {
  border: 0;
  background: #ebebeb;
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.app .tabs button:hover {
  background: #e0e0e0;
}

.app .tabs button[aria-current="page"] {
  background: var(--brand);
  color: #fff;
}

.app #refresh {
  white-space: nowrap;
}

.app .feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.app .note {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  color: var(--text-muted);
  font-size: 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .04);
}

.app .note ul {
  margin: 8px 0 0;
  padding-left: 18px;
  list-style: disc;
}

.app .note.error {
  color: var(--brand-dark);
}

.app .toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.app .toolbar button,
.app .toolbar input,
.app .check {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .03);
}

.app .toolbar button {
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.app .toolbar button[aria-pressed="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.app .toolbar input {
  flex: 1 1 180px;
  padding: 8px 14px;
  min-width: 0;
}

.app .check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-menu);
}

/* Лента новостей как в main.pdf */
.app .news-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .04);
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}

.app .news-row:hover {
  border-color: #d8d8d8;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .06);
  transform: translateY(-1px);
}

.app .news-row:hover .news-title {
  color: var(--brand);
}

.app .news-row.tint-a,
.app .rank-row.tint-a { background: #ffe0e0; border-color: #ffd0d0; }
.app .news-row.tint-b,
.app .rank-row.tint-b { background: #eef7e6; border-color: #ddeecd; }

.icon-menu {
  width: 24px;
  height: 24px;
  background:
    linear-gradient(var(--text), var(--text)) 0 4px / 100% 2px no-repeat,
    linear-gradient(var(--text), var(--text)) 0 11px / 100% 2px no-repeat,
    linear-gradient(var(--text), var(--text)) 0 18px / 100% 2px no-repeat;
}

.app .news-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #f6f6f6;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.app .news-icon img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.app .news-icon span {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-menu);
  text-transform: uppercase;
}

.app .news-body {
  min-width: 0;
}

.app .news-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
}

.app .news-meta {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.app .news-count {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  min-width: 2ch;
  text-align: right;
}

/* Карточка с картинкой, как featured-блок в макете */
.app .news-feature {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .05);
}

.app .news-feature .thumb {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 12px;
  background: #f2f2f2;
  margin: 0;
}

.app .news-feature .news-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
}

.app .news-feature .news-title a {
  color: inherit;
  text-decoration: none;
}

.app .news-feature .news-title a:hover {
  color: var(--brand);
}

.app .news-feature .lead {
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-menu);
}

.app .news-feature .company {
  margin-top: 10px;
}

.app .news-feature details {
  margin-top: 12px;
}

.app .news-feature summary,
.app .news-row-wrap summary {
  cursor: pointer;
  color: var(--brand);
  font-size: 13px;
  font-weight: 500;
}

.app .news-row-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.app .news-row-wrap > details {
  display: none;
  margin: -2px 4px 0;
  padding: 0 12px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 14px 14px;
}

.app .fields {
  margin: 10px 0 0;
}

.app .fields dt {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.app .fields dd {
  margin: 2px 0 0;
}

.app .field-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 220px;
  overflow: auto;
  font-size: 13px;
  color: var(--text-menu);
}

.app .fields ul {
  margin: 4px 0 0;
  padding-left: 18px;
  list-style: disc;
}

/* Страница «Сайты» — как в sites.pdf */
.app .sites-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.app .sites-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 20px;
}

.app .sites-periods {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.app .sites-periods button {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.app .sites-periods button.active {
  color: var(--brand);
  text-decoration-thickness: 2px;
}

.app .sites-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
  text-align: right;
}

.app .sites-card {
  background: #fbfbfb;
  border-radius: 20px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .08);
  overflow: hidden;
  border: 1px solid #ededed;
}

.app .sites-table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
  border: 0;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
}

.app .sites-table thead {
  display: table;
  width: 100%;
  table-layout: fixed;
  background: #ebebeb;
}

.app .sites-table thead th {
  background: #ebebeb;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  padding: 14px 16px;
  border: 0;
  text-align: left;
  white-space: nowrap;
}

.app .sites-table thead th:first-child {
  padding-left: 22px;
}

.app .sites-table thead th:last-child {
  padding-right: 22px;
}

.app .sites-table tbody {
  display: block;
  padding: 8px 10px 12px;
}

.app .sites-table tbody tr {
  display: table;
  width: 100%;
  table-layout: fixed;
  border-radius: 12px;
  transition: background .15s, box-shadow .15s, transform .15s;
}

.app .sites-table tbody tr + tr {
  margin-top: 4px;
}

.app .sites-table tbody td {
  background: transparent;
  border: 0;
  padding: 14px 16px;
  vertical-align: middle;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.app .sites-table tbody tr td:first-child {
  padding-left: 12px;
}

.app .sites-table tbody tr td:last-child {
  padding-right: 12px;
}

.app .sites-table tbody tr:hover {
  background: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .08);
  transform: translateY(-1px);
}

.app .sites-table .col-num {
  width: 56px;
  text-align: left;
}

.app .sites-table .col-news,
.app .sites-table .col-share {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.app .sites-table .col-share {
  width: 110px;
}

.app .sites-table .col-news {
  width: 120px;
}

.app .sites-edition {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.app .sites-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.app .sites-icon img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.app .sites-icon span {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-menu);
}

.app .sites-name {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app .sites-table tbody tr:hover .sites-name {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.app .sites-total {
  margin: 4px 0 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* Персоны / Темы — как в rating.pdf */
.app .ratings-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.app .ratings-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
}

.app .ratings-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.app .ratings-sort {
  color: var(--text-muted);
  font-size: 14px;
}

.app .ratings-sort button {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.app .ratings-sort button.active {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.app .ratings-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.app .ratings-toolbar input,
.app .ratings-toolbar .check {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .03);
}

.app .ratings-toolbar input {
  flex: 1 1 220px;
  padding: 8px 14px;
  min-width: 0;
}

.app .ratings-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.app .ratings-side {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 110px);
  overflow: auto;
  background: #fbfbfb;
  border: 1px solid #ededed;
  border-radius: 18px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .06);
  padding: 8px;
}

.app .ratings-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.app .ratings-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 12px;
  padding: 10px;
  text-align: left;
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
}

.app .ratings-item:hover,
.app .ratings-item.active {
  background: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .08);
}

.app .ratings-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #ffe0e0;
  color: var(--brand-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.app .ratings-avatar.large {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  font-size: 22px;
}

.app .ratings-item-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.app .ratings-item-meta {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted);
}

.app .ratings-item-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
}

.app .ratings-card {
  background: #fff;
  border: 1px solid #ededed;
  border-radius: 20px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .08);
  padding: 18px;
}

.app .ratings-card-head {
  display: grid;
  grid-template-columns: auto minmax(140px, 220px) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding-bottom: 16px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.app .ratings-card-name {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
}

.app .ratings-card-meta {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.app .ratings-chart {
  min-width: 0;
}

.app .ratings-chart-empty {
  color: var(--text-muted);
  font-size: 13px;
  text-align: right;
}

.app .ratings-chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  min-height: 110px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.app .ratings-chart-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 28px;
}

.app .ratings-chart-value {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
}

.app .ratings-chart-bar {
  width: 12px;
  border-radius: 6px 6px 2px 2px;
  background: #f47e7c;
}

.app .ratings-chart-label {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

.app .ratings-news {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.app .ratings-news-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: #f5f5f5;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: background .15s, box-shadow .15s;
}

.app .ratings-news-row:hover {
  background: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .08);
}

.app .ratings-news-title {
  font-size: 15px;
  font-weight: 600;
  color: #1d4f91;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.app .ratings-news-row:hover .ratings-news-title {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.app .ratings-news-meta {
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-muted);
}

.app .ratings-news-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.app .ratings-total {
  margin: 8px 0 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

@media (max-width: 640px) {
  .app {
    padding: var(--space-4) 0 var(--space-7);
  }

  .app .container {
    padding: 0 12px;
  }

  .app-bar {
    gap: 10px;
  }

  .app #refresh {
    width: 100%;
    text-align: center;
  }

  .app .news-feature {
    grid-template-columns: 1fr;
  }

  .app .news-feature .thumb {
    height: 180px;
  }

  .app .news-row {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 12px;
  }

  .app .news-title {
    font-size: 14px;
  }

  .app .news-count,
  .app .rank-value {
    font-size: 16px;
  }

  .app .sites-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .app .sites-title {
    font-size: 18px;
    text-align: left;
  }

  .app .sites-table thead th,
  .app .sites-table tbody td {
    padding: 12px 10px;
    font-size: 13px;
  }

  .app .sites-table thead th:first-child,
  .app .sites-table tbody tr td:first-child {
    padding-left: 12px;
  }

  .app .sites-table thead th:last-child,
  .app .sites-table tbody tr td:last-child {
    padding-right: 12px;
  }

  .app .sites-table .col-share {
    width: 72px;
  }

  .app .sites-table .col-news {
    width: 72px;
  }

  .app .sites-icon {
    width: 30px;
    height: 30px;
  }

  .app .ratings-layout {
    grid-template-columns: 1fr;
  }

  .app .ratings-side {
    position: static;
    max-height: 280px;
  }

  .app .ratings-card-head {
    grid-template-columns: auto 1fr;
  }

  .app .ratings-chart {
    grid-column: 1 / -1;
  }

  .app .ratings-card-name {
    font-size: 20px;
  }
}
