/* Строгая тема: навигация, типографика, карточки — поверх Bootstrap 5.3 */

:root {
  color-scheme: light;
  /* 8px spacing scale (для согласованных отступов) */
  --ra-space-1: 0.25rem; /* 4px */
  --ra-space-2: 0.5rem; /* 8px */
  --ra-space-3: 1rem; /* 16px */
  --ra-space-4: 1.5rem; /* 24px */
  --ra-space-5: 2rem; /* 32px */
  --ra-ink: #0f172a;
  --ra-ink-muted: #475569;
  --ra-surface: #ffffff;
  --ra-surface-2: #f8fafc;
  --ra-border: #e2e8f0;
  --ra-accent: #0f2744;
  --ra-accent-hover: #0a1c33;
  --ra-teal: #0d6e7a;
  --ra-radius: 12px;
  --ra-radius-sm: 8px;
  --ra-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 4px 16px rgba(15, 23, 42, 0.08);
  --ra-shadow-sm: 0 1px 0 rgba(15, 23, 42, 0.04);
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-color: var(--ra-ink);
  --bs-body-bg: #f1f5f9;
  --bs-primary: var(--ra-accent);
  --bs-primary-rgb: 15, 39, 68;
  --bs-link-color: #1d4e7a;
  --bs-link-hover-color: #0f2744;
  --bs-border-color: var(--ra-border);
  --bs-border-radius: var(--ra-radius-sm);
  --bs-card-border-radius: var(--ra-radius);
  --bs-card-box-shadow: var(--ra-shadow);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-feature-settings: "kern" 1, "liga" 1;
  -webkit-font-smoothing: antialiased;
}

a {
  text-underline-offset: 0.14em;
}

.site-header {
  z-index: 1030;
  box-shadow: 0 1px 0 var(--ra-border);
}

.site-header .navbar {
  --bs-navbar-padding-y: 0.65rem;
}

.brand-mark {
  flex-shrink: 0;
}

.brand-text {
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: 1.05rem;
  color: var(--ra-ink);
}

.navbar .nav-link {
  font-weight: 500;
  color: var(--ra-ink-muted);
  padding: 0.5rem 0.85rem;
  border-radius: var(--ra-radius-sm);
}

.navbar .nav-link:hover,
.navbar .nav-link:focus {
  color: var(--ra-accent);
  background: rgba(15, 39, 68, 0.06);
}

.navbar .nav-link.active {
  color: var(--ra-accent);
  background: rgba(15, 39, 68, 0.08);
}

.navbar-toggler {
  border-color: var(--ra-border);
  padding: 0.4rem 0.55rem;
}

.navbar-toggler:focus {
  box-shadow: 0 0 0 0.2rem rgba(15, 39, 68, 0.15);
}

.site-main {
  flex: 1 0 auto;
}

.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--ra-border);
  background: var(--ra-surface);
  color: var(--ra-ink-muted);
  font-size: 0.8125rem;
}

/* Список проектов: узкая колонка иконок */
.ra-project-col-status {
  width: 1%;
  white-space: nowrap;
  vertical-align: middle;
}

.ra-project-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.5rem;
  min-width: 1.5rem;
  vertical-align: middle;
  cursor: help;
}

.ra-project-name-muted {
  font-weight: 500;
  color: var(--ra-ink);
}

/* Вкладка «Отзывы»: фильтры под спойлером на узких экранах */
.ra-reviews-filters-details > summary.ra-reviews-filters-details__summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.ra-reviews-filters-details > summary.ra-reviews-filters-details__summary::-webkit-details-marker {
  display: none;
}

.ra-reviews-filters-details > summary.ra-reviews-filters-details__summary::marker {
  content: "";
}

@media (min-width: 768px) {
  .ra-reviews-filters-details > summary.ra-reviews-filters-details__summary {
    cursor: default;
  }
}

/* Вкладка «Отзывы»: на узком экране — карточки вместо таблицы */
.ra-reviews-mobile-guide__list {
  font-size: 0.8125rem;
  line-height: 1.45;
}

.ra-results-mobile-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ra-review-mobile-card {
  position: relative;
  text-align: left;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: var(--ra-radius);
  padding: 0.85rem 1rem 0.65rem;
  border-left-width: 4px;
  border-left-style: solid;
  box-shadow: var(--ra-shadow-sm);
  cursor: pointer;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.ra-review-mobile-card:focus {
  outline: none;
}

.ra-review-mobile-card:focus-visible {
  outline: 2px solid rgba(15, 39, 68, 0.35);
  outline-offset: 2px;
}

.ra-review-mobile-card--positive {
  border-left-color: #198754;
  background: rgba(25, 135, 84, 0.11);
}

.ra-review-mobile-card--negative {
  border-left-color: #dc3545;
  background: rgba(220, 53, 69, 0.1);
}

.ra-review-mobile-card--neutral {
  border-left-color: #64748b;
  background: rgba(100, 116, 139, 0.11);
}

.ra-review-mobile-card--other {
  border-left-color: #fd7e14;
  background: rgba(253, 126, 20, 0.11);
}

.ra-review-mobile-card--meta-open {
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.ra-review-mobile-card__main {
  cursor: text;
}

.ra-review-mobile-card .ra-review-text-stack {
  min-height: 0;
}

.ra-review-mobile-card .ra-review-text-body {
  position: relative;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
  font-size: 0.9375rem;
  color: var(--ra-ink);
}

.ra-review-mobile-card .ra-review-text-body.ra-review-text-collapsed {
  max-height: 6rem;
  overflow: hidden;
}

.ra-review-mobile-card .ra-review-text-body.ra-review-text-collapsed::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1.25rem;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.88));
}

.ra-review-mobile-card__meta {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(15, 23, 42, 0.1);
}

.ra-review-mobile-card__field {
  display: grid;
  grid-template-columns: minmax(5.5rem, 34%) 1fr;
  gap: 0.35rem 0.5rem;
  align-items: baseline;
  margin-bottom: 0.5rem;
  font-size: 0.8125rem;
}

.ra-review-mobile-card__field:last-child {
  margin-bottom: 0;
}

.ra-review-mobile-card__label {
  color: var(--ra-ink-muted);
  font-weight: 500;
}

.ra-review-mobile-card__val {
  min-width: 0;
  word-break: break-word;
}

.ra-review-mobile-card .ra-review-expand-link {
  text-align: right;
}

.ra-js-analyze-poll {
  min-height: 1.5rem;
}

.ra-js-analyze-poll .ra-js-analyze-poll-text {
  font-size: 0.875rem;
  color: var(--ra-ink-muted);
}

/* Страницы */
.page-stack {
  max-width: 72rem;
  margin-inline: auto;
}

.page-hero {
  margin-bottom: 1.5rem;
}

.page-title {
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ra-ink);
  font-size: clamp(1.35rem, 2.5vw, 1.65rem);
}

.page-lead {
  color: var(--ra-ink-muted);
  max-width: 48rem;
  font-size: 0.9375rem;
  line-height: 1.55;
}

.page-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.projects-search .form-control {
  max-width: min(100%, 28rem);
}

/* Дашборд: фиксированная высота только у canvas-графика; «Подсказка» без min-height, чтобы не было пустоты */
@media (min-width: 992px) {
  .ra-row-sentiment .chart-stage--sentiment {
    flex: 0 0 auto;
    height: 260px;
    max-height: 260px;
  }

  .ra-row-sentiment .insight-body-shell--sentiment {
    flex: 0 1 auto;
    min-height: 0;
  }

  .ra-row-sentiment .insight-body-text.insight-body-collapsed {
    max-height: 15rem;
  }
}

/* Узкий экран: тот же принцип без фиксированной сетки колонок */
@media (max-width: 991.98px) {
  .ra-row-sentiment .chart-stage--sentiment {
    flex: 0 0 auto;
    height: 240px;
    max-height: 240px;
  }

  .ra-row-sentiment .insight-body-shell--sentiment {
    min-height: 0;
  }

  .ra-row-sentiment .insight-body-text.insight-body-collapsed {
    max-height: 13rem;
  }
}

.chart-stage--sentiment,
.chart-stage--keywords {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Узкая колонка по центру карточки: кольцо тональности и облако слов */
.ra-chart-center-slot {
  width: min(100%, 300px);
  height: 100%;
  min-height: 0;
  flex: 1 1 auto;
  position: relative;
}

.ra-chart-center-slot--keywords {
  width: min(100%, 400px);
  max-width: 400px;
}

.ra-row-sentiment .chart-stage--keywords .ra-keyword-chart-empty:not(.d-none) {
  position: absolute;
  inset: 0;
  display: flex;
}

@media (min-width: 992px) {
  .ra-row-sentiment .chart-stage--keywords {
    flex: 0 0 auto;
    height: 260px;
    max-height: 260px;
  }
}

@media (max-width: 991.98px) {
  .ra-row-sentiment .chart-stage--keywords {
    flex: 0 0 auto;
    height: 240px;
    max-height: 240px;
  }
}

/* «Темы и тональность» / «Боль»: без фиксированной высоты Chart.js + flex-grow раздувают canvas
   при каждом открытии/закрытии «Подсказка» (details). */
.ra-row-topics > [class*="col"] {
  min-height: 0;
}

.ra-row-topics .ra-chart-card-body {
  min-height: 0;
}

.ra-row-topics .ra-chart-stage-fixed-h {
  flex: 0 0 auto;
  width: 100%;
  height: clamp(260px, 36vh, 400px);
  min-height: 240px;
  max-height: 400px;
  overflow: hidden;
}

.ra-chart-keyword-chip:not(.d-none) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

#pane-insight .insight-body-text.insight-body-collapsed {
  max-height: 18rem;
}

.insight-body-text {
  position: relative;
  transition: max-height 0.2s ease;
}

.insight-body-text.insight-body-collapsed {
  max-height: 8rem;
  overflow: hidden;
  cursor: pointer;
}

.insight-body-text.insight-body-collapsed:focus-visible {
  outline: 2px solid rgba(15, 39, 68, 0.35);
  outline-offset: 2px;
}

.insight-body-text.insight-body-collapsed::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2.25rem;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--ra-surface));
}

.insight-body-text.insight-body-expanded::after {
  display: none;
}

.insight-body-text.insight-body-expanded {
  cursor: default;
  max-height: none;
}

.card {
  background: var(--ra-surface);
  border: 1px solid var(--ra-border);
  border-radius: var(--ra-radius);
  box-shadow: var(--ra-shadow);
}

.card-header {
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
  background: var(--ra-surface);
  border-bottom: 1px solid var(--ra-border);
  border-top-left-radius: var(--ra-radius);
  border-top-right-radius: var(--ra-radius);
}

.table {
  --bs-table-hover-bg: rgba(15, 39, 68, 0.04);
}

.table thead th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: var(--ra-ink-muted);
  border-bottom-width: 1px;
  padding-top: var(--ra-space-3);
  padding-bottom: var(--ra-space-2);
  vertical-align: middle;
}

/* Таблицы без вертикальных границ, с «воздухом» в строках */
table.ra-data-table {
  --bs-table-border-color: transparent;
  border-collapse: separate;
  border-spacing: 0;
}

table.ra-data-table > :not(caption) > * > * {
  border-left-width: 0;
  border-right-width: 0;
  padding: var(--ra-space-3) var(--ra-space-2);
  vertical-align: middle;
}

table.ra-data-table tbody td,
table.ra-data-table tbody th {
  border-bottom: 1px solid var(--ra-border);
}

table.ra-data-table.table-sm > :not(caption) > * > * {
  padding: var(--ra-space-2) var(--ra-space-2);
}

table.ra-data-table thead th {
  border-bottom: 1px solid var(--ra-border);
}

.table-responsive {
  border: 1px solid var(--ra-border);
  border-radius: var(--ra-radius);
  overflow: hidden;
  background: var(--ra-surface);
  box-shadow: var(--ra-shadow-sm);
}

/* Блок таблицы в карточке: без отдельной вертикальной прокрутки; горизонталь — по необходимости */
.table-responsive.ra-table-inline {
  box-shadow: none;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}

#resultsTable.ra-data-table {
  min-width: 100%;
}

#resultsTable.ra-data-table tbody td,
#resultsTable.ra-data-table tbody th {
  line-height: 1.55;
  font-size: 0.875rem;
  padding: 0.85rem 0.85rem;
}

#resultsTable.ra-data-table tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.025);
}

#resultsTable.ra-data-table tbody tr:hover {
  background: rgba(15, 39, 68, 0.06) !important;
}

#resultsTable.ra-data-table thead th {
  background: var(--ra-surface);
  white-space: nowrap;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

#resultsTable.ra-data-table td:not(.ra-review-text-cell) {
  max-width: 12rem;
  word-break: break-word;
  vertical-align: top;
}

/* Отступы между «Назад», номерами и «Вперёд» */
.ra-table-pager {
  --bs-btn-padding-x: 0.5rem;
  column-gap: 0.75rem;
  row-gap: 0.5rem;
}

.ra-table-pager > .btn {
  margin: 0;
}

.ra-table-page-btns {
  column-gap: 0.5rem;
  row-gap: 0.35rem;
  margin-inline: 0.15rem;
  padding-inline: 0.2rem;
}

#resultsTable .ra-pill {
  white-space: nowrap;
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Пагинация в шапке карточки «Отзывы», не на фоне страницы */
.ra-reviews-toolbar {
  background: var(--ra-surface);
}

.ra-reviews-footer {
  background: var(--ra-surface);
}

#resultsTable .ra-review-text-stack {
  /* Единая «высотная сетка»: свернутый длинный и короткий (≤500) визуально в одной полосе */
  min-height: 6.75rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.3rem;
}

#resultsTable .ra-review-text-stack .ra-review-text-body {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  line-height: 1.45;
  align-self: stretch;
}

/** Ссылка «развернуть» — внизу «полосы» отзыва, как в свернутом варианте */
button.ra-review-expand-link {
  display: inline-block;
  width: auto;
  max-width: 100%;
  margin: 0;
  margin-top: auto;
  padding: 0.05rem 0;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.25;
  color: var(--ra-accent);
  background: transparent;
  border: none;
  text-decoration: underline;
  text-underline-offset: 0.12em;
  cursor: pointer;
  text-align: right;
  align-self: flex-end;
  flex-shrink: 0;
  border-radius: var(--ra-radius-sm);
  box-shadow: none;
}

button.ra-review-expand-link:hover {
  color: var(--ra-accent-hover);
}

button.ra-review-expand-link:focus-visible {
  outline: 2px solid rgba(15, 39, 68, 0.35);
  outline-offset: 1px;
}

.table-hover tbody tr:hover td {
  color: var(--ra-ink);
}

/* Бейджи тональности (таблица отзывов) */
.ra-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 0.2em 0.6em;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.3;
  border-radius: 9999px;
  white-space: normal;
  word-break: break-word;
}

.ra-pill--sentiment.ra-pill--positive {
  color: #0d4f2c;
  background: rgba(25, 135, 84, 0.12);
}

.ra-pill--sentiment.ra-pill--negative {
  color: #842029;
  background: rgba(220, 53, 69, 0.12);
}

.ra-pill--sentiment.ra-pill--neutral {
  color: #374151;
  background: rgba(100, 116, 139, 0.14);
}

.ra-pill--sentiment.ra-pill--other {
  color: #7c2d12;
  background: rgba(253, 126, 20, 0.16);
}

.ra-pill--sentiment.ra-pill--muted {
  color: var(--ra-ink-muted);
  background: rgba(15, 23, 42, 0.06);
}

/* Модалка «Отзывы за дату» / по клику на график: цвет карточки = тональность */
#reviewsByDateModal .ra-reviews-by-date__item {
  border-left: 4px solid transparent;
  overflow: visible;
}

#reviewsByDateModal .ra-reviews-by-date__item--positive {
  border-left-color: #198754;
  background: rgba(25, 135, 84, 0.06);
}

#reviewsByDateModal .ra-reviews-by-date__item--negative {
  border-left-color: #dc3545;
  background: rgba(220, 53, 69, 0.06);
}

#reviewsByDateModal .ra-reviews-by-date__item--neutral {
  border-left-color: #64748b;
  background: rgba(100, 116, 139, 0.08);
}

#reviewsByDateModal .ra-reviews-by-date__item--other {
  border-left-color: #fd7e14;
  background: rgba(253, 126, 20, 0.08);
}

#reviewsByDateModal .ra-reviews-by-date__item--positive .accordion-button,
#reviewsByDateModal .ra-reviews-by-date__item--negative .accordion-button,
#reviewsByDateModal .ra-reviews-by-date__item--neutral .accordion-button,
#reviewsByDateModal .ra-reviews-by-date__item--other .accordion-button {
  background-color: transparent;
}

#reviewsByDateModal .ra-reviews-by-date__item--positive .accordion-button:not(.collapsed) {
  background: rgba(25, 135, 84, 0.1);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.06);
}

#reviewsByDateModal .ra-reviews-by-date__item--negative .accordion-button:not(.collapsed) {
  background: rgba(220, 53, 69, 0.1);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.06);
}

#reviewsByDateModal .ra-reviews-by-date__item--neutral .accordion-button:not(.collapsed) {
  background: rgba(100, 116, 139, 0.1);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.06);
}

#reviewsByDateModal .ra-reviews-by-date__item--other .accordion-button:not(.collapsed) {
  background: rgba(253, 126, 20, 0.12);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.06);
}

#reviewsByDateModal .ra-reviews-by-date__item .accordion-body {
  background: var(--ra-surface);
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.ra-insight-panel {
  background: var(--ra-surface) !important;
  border: 1px solid var(--ra-border) !important;
}

/* Вкладка «Аналитика»: отрисовка Markdown */
#insightBody.ra-insight-markdown {
  white-space: normal;
  line-height: 1.55;
}

#insightBody.ra-insight-markdown > *:first-child {
  margin-top: 0;
}

#insightBody.ra-insight-markdown > *:last-child {
  margin-bottom: 0;
}

#insightBody.ra-insight-markdown h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  letter-spacing: -0.015em;
  color: var(--ra-ink);
}

#insightBody.ra-insight-markdown h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 0.85rem;
  margin-bottom: 0.35rem;
  color: var(--ra-ink);
}

#insightBody.ra-insight-markdown p {
  margin-bottom: 0.65rem;
}

#insightBody.ra-insight-markdown ul,
#insightBody.ra-insight-markdown ol {
  margin-bottom: 0.65rem;
  padding-left: 1.25rem;
}

#insightBody.ra-insight-markdown li {
  margin-bottom: 0.35rem;
}

#insightBody.ra-insight-markdown li::marker {
  color: var(--ra-ink-muted);
}

#insightBody.ra-insight-markdown strong {
  font-weight: 600;
  color: var(--ra-ink);
}

#insightBody.ra-insight-markdown code {
  font-size: 0.85em;
  padding: 0.1em 0.35em;
  border-radius: 0.25rem;
  background: rgba(15, 23, 42, 0.06);
}

#insightBody.ra-insight-markdown pre {
  font-size: 0.8125rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--ra-radius-sm);
  background: rgba(15, 23, 42, 0.06);
  overflow-x: auto;
  margin-bottom: 0.65rem;
}

#insightBody.ra-insight-markdown pre code {
  padding: 0;
  background: none;
}

#insightBody.ra-insight-markdown blockquote {
  margin: 0 0 0.65rem;
  padding-left: 0.85rem;
  border-left: 3px solid rgba(15, 39, 68, 0.22);
  color: var(--ra-ink-muted);
}

#insightBody.ra-insight-markdown hr {
  margin: 0.75rem 0;
  opacity: 0.35;
}

#insightBody.ra-insight-markdown a {
  color: var(--ra-accent);
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

#insightBody.ra-insight-markdown table {
  font-size: 0.8125rem;
  width: 100%;
  margin-bottom: 0.65rem;
  border-collapse: collapse;
}

#insightBody.ra-insight-markdown th,
#insightBody.ra-insight-markdown td {
  border: 1px solid var(--ra-border);
  padding: 0.35rem 0.5rem;
  text-align: left;
  vertical-align: top;
}

/* Подсказки: белая карточка вместо серой плашки */
details.ra-hint {
  background: var(--ra-surface) !important;
  box-shadow: var(--ra-shadow-sm);
}

.badge.bg-secondary {
  background-color: #64748b !important;
  font-weight: 500;
}

.btn-primary {
  --bs-btn-bg: var(--ra-accent);
  --bs-btn-border-color: var(--ra-accent);
  --bs-btn-hover-bg: var(--ra-accent-hover);
  --bs-btn-hover-border-color: var(--ra-accent-hover);
  --bs-btn-active-bg: var(--ra-accent-hover);
  --bs-btn-active-border-color: var(--ra-accent-hover);
  font-weight: 600;
}

.btn-success {
  --bs-btn-bg: #157a4a;
  --bs-btn-border-color: #157a4a;
  --bs-btn-hover-bg: #0f5c38;
  --bs-btn-hover-border-color: #0f5c38;
  font-weight: 600;
}

.btn-outline-primary {
  --bs-btn-color: var(--ra-accent);
  --bs-btn-border-color: rgba(15, 39, 68, 0.35);
  --bs-btn-hover-bg: var(--ra-accent);
  --bs-btn-hover-border-color: var(--ra-accent);
  font-weight: 600;
}

.form-control:focus,
.form-select:focus {
  border-color: rgba(15, 39, 68, 0.45);
  box-shadow: 0 0 0 0.2rem rgba(15, 39, 68, 0.12);
}

.nav-tabs .nav-link {
  font-weight: 600;
  color: var(--ra-ink-muted);
  border: 1px solid transparent;
}

.nav-tabs .nav-link:hover {
  color: var(--ra-accent);
  border-color: var(--ra-border) var(--ra-border) transparent;
}

.nav-tabs .nav-link.active {
  color: var(--ra-accent);
  border-color: var(--ra-border) var(--ra-border) var(--ra-surface);
}

.modal-header {
  border-bottom-color: var(--ra-border);
}

.modal-title {
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* Страница «новый проект» — одна узкая колонка по центру */
.ra-project-new {
  width: 100%;
  max-width: 38rem;
  margin-inline: auto;
}

.ra-project-new .page-lead {
  max-width: none;
}

/* Форма «новый проект» — узкая колонка */
.narrow-form {
  max-width: 38rem;
}

.ra-project-new .narrow-form {
  max-width: none;
}

/* Вкладки «Файл / Google Таблица» */
.ra-project-source {
  background: var(--ra-surface-2);
  border: 1px solid var(--ra-border);
  border-radius: var(--ra-radius);
}

.ra-project-source .nav-pills .nav-link {
  color: var(--ra-ink-muted);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.55rem 0.35rem;
  line-height: 1.2;
  border: 1px solid transparent;
}

@media (min-width: 576px) {
  .ra-project-source .nav-pills .nav-link {
    font-size: 0.95rem;
    padding: 0.65rem 0.5rem;
  }
}

.ra-project-source .nav-pills .nav-link:hover {
  color: var(--ra-accent);
  background: rgba(15, 39, 68, 0.06);
}

.ra-project-source .nav-pills .nav-link.active {
  color: #fff;
  background: var(--ra-accent);
  border-color: var(--ra-accent);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.08);
}

.ra-project-source .nav-pills .nav-link:focus-visible {
  outline: 2px solid var(--ra-accent);
  outline-offset: 2px;
}

.ra-project-source .tab-pane {
  min-height: 0;
  padding: 0.15rem 0.05rem 0 0.05rem;
}

/* Страница входа (раскладка в духе Auth0: без шапки/подвала, картоска по центру) */
.ra-body-login {
  background: var(--ra-surface-2);
}

.ra-site-main--login {
  min-height: 0;
}

.ra-page-stack--login {
  box-sizing: border-box;
  flex: 1 1 auto;
  justify-content: center;
  padding: clamp(1.5rem, 10vh, 4rem) 1rem 2.5rem;
}

.ra-auth-login {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 26rem;
  margin-inline: auto;
}

.ra-auth-login__brand {
  text-align: center;
  margin-bottom: 1.75rem;
}

.ra-auth-login__logo {
  display: block;
  margin-inline: auto;
  margin-bottom: 1rem;
}

.ra-auth-login__app-name {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ra-ink);
  margin: 0;
}

.ra-auth-login__card {
  width: 100%;
  border-radius: var(--ra-radius);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.1) !important;
  background: var(--ra-surface);
}

/* Деталь проекта: шапка */
.project-head {
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--ra-border);
  margin-bottom: 1.25rem;
}

@media (max-width: 575.98px) {
  .project-head .d-flex.flex-wrap.gap-2 {
    width: 100%;
  }

  .project-head .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
}

/* Подсказки details */
details.ra-hint > summary {
  cursor: pointer;
  list-style: none;
}

details.ra-hint > summary::-webkit-details-marker {
  display: none;
}

details.ra-hint > summary::before {
  content: "";
  display: inline-block;
  width: 0.35em;
  height: 0.35em;
  margin-right: 0.45em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  vertical-align: 0.15em;
  opacity: 0.65;
}

details[open].ra-hint > summary::before {
  transform: rotate(45deg);
  vertical-align: 0.05em;
}

/* Таблица результатов: текст отзыва — свёрнут по высоте, ссылка «развернуть» */
#resultsTable.ra-data-table tbody td.ra-review-text-cell {
  vertical-align: top;
  min-width: 10rem;
  max-width: 40rem;
  padding-top: 0.8rem;
  padding-bottom: 0.8rem;
}

#resultsTable .ra-review-text-body {
  position: relative;
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
}

#resultsTable .ra-review-text-body.ra-review-text-collapsed {
  flex: 0 0 auto;
  /* ~3–4 строки превью, ближе по высоте к полноразмерным коротким отзывам */
  max-height: 5.25rem;
  overflow: hidden;
}

#resultsTable tbody tr:nth-child(odd) .ra-review-text-body.ra-review-text-collapsed::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1.1rem;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--ra-surface));
}

#resultsTable tbody tr:nth-child(even) .ra-review-text-body.ra-review-text-collapsed::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1.1rem;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(15, 23, 42, 0.025));
}

/* Таблица результатов: читаемость на узком экране */
@media (max-width: 575.98px) {
  .table-responsive .table {
    font-size: 0.8125rem;
  }

  #resultsTable.ra-data-table tbody td.ra-review-text-cell {
    min-width: 70vw;
    max-width: none;
  }

  .page-toolbar .btn {
    width: 100%;
    justify-content: center;
  }

  #tablePagerTop .ms-md-auto {
    width: 100%;
    justify-content: center;
  }

  #tablePagerTop .ra-table-pager,
  .card-footer .ra-table-pager {
    width: 100%;
    justify-content: center;
  }
}

/* Кнопка «три точки» в списке проектов */
.ra-project-menu-btn {
  line-height: 1;
  min-width: 2rem;
  min-height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

/* Канвасы графиков — не выходят за контейнер */
canvas {
  max-width: 100%;
}
