:root {
  color-scheme: light;
  --bg: #0b1220;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-2: rgba(255, 255, 255, 0.09);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.68);
  --border: rgba(255, 255, 255, 0.12);
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
  --accent: #7c3aed;
  --accent-2: #22c55e;
  --danger: #fb7185;
  --focus: rgba(124, 58, 237, 0.35);
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
    monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji",
    "Segoe UI Emoji";
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: radial-gradient(1200px 700px at 20% 0%, rgba(124, 58, 237, 0.35), transparent 60%),
    radial-gradient(900px 600px at 90% 10%, rgba(34, 197, 94, 0.22), transparent 55%),
    var(--bg);
  min-height: 100vh;
}

a {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.app-sidebar {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 22px;
  height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid var(--border);
  background: rgba(10, 16, 28, 0.72);
  backdrop-filter: blur(18px);
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.workspace-nav {
  display: grid;
  align-content: start;
  gap: 10px;
}

.nav-item {
  display: grid;
  gap: 4px;
  width: 100%;
  text-align: left;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.nav-item span {
  font-size: 15px;
}

.nav-item small {
  color: var(--muted);
  font-weight: 500;
}

.nav-item.active {
  border-color: rgba(124, 58, 237, 0.65);
  background: rgba(124, 58, 237, 0.22);
}

.sidebar-footer {
  display: grid;
  gap: 10px;
}

.app-version {
  margin: 0;
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-muted, #7a8a9e);
  letter-spacing: 0.01em;
}

.workspace-panel {
  display: none;
  min-width: 0;
}

.workspace-panel.active {
  display: grid;
  gap: 16px;
}

.workspace-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2px;
}

.workspace-header h2 {
  margin: 0 0 6px;
  font-size: 24px;
  letter-spacing: -0.02em;
}

.workspace-header p {
  margin: 0;
  max-width: 76ch;
  color: var(--muted);
  line-height: 1.45;
}

.workspace-howto-btn {
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 4px;
  white-space: nowrap;
}

.workspace-grid {
  display: grid;
  gap: 16px;
  align-items: start;
  min-width: 0;
}

.search-workspace-grid {
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
}

.jobs-workspace-grid {
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  align-items: start;
}

.jobs-workspace-grid > .card {
  min-width: 0;
  overflow: hidden;
}

.jobs-full-width {
  grid-column: 1 / -1;
}

.search-results-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.sticky-side-panel {
  position: sticky;
  top: 28px;
  display: grid;
  gap: 12px;
  align-self: start;
  max-height: calc(100vh - 56px);
  overflow: auto;
}

.inner-card {
  box-shadow: none;
  background: rgba(255, 255, 255, 0.035);
}

.tabs {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  margin: 0 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.16);
}

.tab {
  padding: 7px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.tab.active {
  background: rgba(124, 58, 237, 0.28);
  color: var(--text);
}

.analysis-card {
  min-width: 0;
}

.full-width {
  width: 100%;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: static;
    height: auto;
    grid-template-columns: 1fr;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .workspace-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .workspace {
    padding: 20px;
  }

  .search-workspace-grid,
  .jobs-workspace-grid,
  .search-results-grid {
    grid-template-columns: 1fr;
  }

  .sticky-side-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 640px) {
  .workspace-nav {
    grid-template-columns: 1fr;
  }

  .workspace-header {
    display: grid;
  }
}

.shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 18px 44px;
}

.top {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.brand h1 {
  margin: 0 0 8px;
  font-size: 28px;
  letter-spacing: -0.02em;
}

.brand p {
  margin: 0;
  color: var(--muted);
  max-width: 72ch;
  line-height: 1.45;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 999px;
  color: var(--muted);
  white-space: nowrap;
}

.pill strong {
  color: var(--text);
  font-weight: 650;
}

.layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 16px;
  align-items: start;
}

.right-stack {
  display: grid;
  gap: 16px;
  align-items: start;
}

.left-stack {
  display: grid;
  gap: 16px;
  align-items: start;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .top {
    flex-direction: column;
  }
  .pill {
    white-space: normal;
  }
}

.card {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel), rgba(255, 255, 255, 0.04));
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.card h2 {
  margin: 0 0 12px;
  font-size: 14px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.subhead {
  margin: 2px 0 0;
  font-size: 13px;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.82);
}

.form-grid {
  display: grid;
  gap: 12px;
}

.advanced {
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px;
}

.advanced summary {
  cursor: pointer;
  font-weight: 650;
  color: rgba(255, 255, 255, 0.86);
}

/* Маркер раскрытия (как у «Параметры отбора»): видимый треугольник для всех advanced-details */
details.advanced > summary::marker,
details.advanced > summary::-webkit-details-marker {
  color: rgba(147, 197, 253, 0.65);
}

details.advanced[open] > summary::marker,
details.advanced[open] > summary::-webkit-details-marker {
  color: rgba(147, 197, 253, 0.85);
}

.advanced-body {
  margin-top: 10px;
}

.analysis-csv-details-body .workspace-header {
  align-items: flex-start;
}

.analysis-csv-inline-title {
  margin: 0 0 6px;
  font-size: 17px;
}

.builder-block {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.builder-summary {
  min-width: 0;
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.16);
  color: rgba(255, 255, 255, 0.84);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.job-funnel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(130px, 100%), 1fr));
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.funnel-step {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  overflow-wrap: anywhere;
}

.funnel-step strong {
  display: block;
  margin-bottom: 4px;
  font-size: 20px;
}

.funnel-step span {
  color: var(--muted);
  font-size: 12px;
}

.json-preview {
  min-width: 0;
  max-width: 100%;
  max-height: 260px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  color: rgba(255, 255, 255, 0.86);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
}

.form-grid.two-col {
  grid-template-columns: 1fr 1fr;
}

.form-grid.three-col {
  grid-template-columns: minmax(140px, 0.7fr) minmax(120px, 0.5fr) minmax(220px, 1.4fr);
}

@media (max-width: 520px) {
  .form-grid.two-col,
  .form-grid.three-col {
    grid-template-columns: 1fr;
  }
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

input,
select {
  width: 100%;
  padding: 10px 11px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(124, 58, 237, 0.55);
  box-shadow: 0 0 0 4px var(--focus);
}

.hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.35;
}

.quick-picks,
.selected-categories-toolbar,
.category-results-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.selected-categories-toolbar button,
.category-results-toolbar button {
  flex: 1 1 auto;
  min-width: min(100%, 140px);
}

.category-tree-status {
  margin-top: 10px;
  outline: none;
}

.selected-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.selected-summary {
  flex: 1 0 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
}

.quick-pick,
.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
}

.quick-pick {
  cursor: pointer;
}

.quick-pick:hover {
  background: rgba(255, 255, 255, 0.09);
}

.quick-pick.active {
  border-color: rgba(124, 58, 237, 0.55);
  background: rgba(124, 58, 237, 0.18);
}

.all-languages {
  flex: 1 0 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
}

.language-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 8px;
  align-items: center;
  text-align: left;
  padding: 8px 10px;
  border-radius: 10px;
}

.language-option strong {
  grid-row: span 2;
  font-family: var(--mono);
  color: var(--text);
}

.language-option span {
  color: var(--text);
  font-size: 13px;
}

.language-option small {
  color: var(--muted);
  font-weight: 500;
}

.search-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(180px, 0.8fr);
  gap: 12px;
  margin-top: 12px;
}

@media (max-width: 980px) {
  .search-columns {
    grid-template-columns: 1fr;
  }
}

.discovery-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.table-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
}

.compact-table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.16);
}

.category-table-details {
  display: grid;
  gap: 8px;
}

.category-table-details summary {
  cursor: pointer;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.category-table-details[open] summary {
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}

.category-table {
  min-width: 100%;
}

.category-table-paged {
  display: grid;
  gap: 8px;
}

.category-table-pagination {
  align-items: center;
  margin-bottom: 0;
}

.inline-field {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.inline-field input {
  width: 76px;
}

.compact-table th,
.compact-table td {
  padding: 9px 10px;
}

.compact-table td {
  font-size: 13px;
}

.compact-table td:nth-child(2),
.compact-table td:nth-child(4),
.compact-table td:nth-child(5) {
  white-space: nowrap;
  font-family: var(--mono);
  color: rgba(255, 255, 255, 0.82);
}

.compact-table .total-row td {
  position: sticky;
  top: 41px;
  z-index: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(124, 58, 237, 0.18);
  color: var(--text);
  font-weight: 750;
}

.category-table th:first-child,
.category-table td:first-child {
  width: 56px;
  text-align: center;
}

.category-table th:nth-child(2),
.category-table td:nth-child(2) {
  width: 52px;
  text-align: right;
  color: var(--muted);
}

.category-table td:nth-child(3) {
  white-space: normal;
  font-family: var(--sans);
  color: var(--text);
}

.category-table .total-row td:nth-child(3) {
  font-family: var(--sans);
}

.category-selection-cell input {
  width: 16px;
  height: 16px;
}

.category-table tr.selected-row td {
  background: rgba(124, 58, 237, 0.12);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 230px;
}

.row-actions button {
  padding: 7px 9px;
  font-size: 12px;
}

/* TODO: remove category navigation after experiments. Discovery cards are part of the disabled category browser. */
.discovery-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.jobs-filter-label {
  margin-top: 6px;
}

/* Отступ между основными кнопками запуска и блоком дополнительных действий */
.job-extra-actions {
  margin-top: 6px;
}

/* Небольшой зазор между заголовком details и кнопками внутри */
.job-extra-actions .advanced-body.actions {
  margin-top: 7px;
  padding-top: 3px;
}

.jobs-table-host {
  min-width: 0;
}

.jobs-table {
  min-width: 980px;
}

.jobs-table th,
.jobs-table td {
  padding: 7px 8px;
  vertical-align: middle;
}

.jobs-table tr.selected-row td {
  background: rgba(124, 58, 237, 0.12);
}

.jobs-table .job-source-cell {
  min-width: 220px;
  max-width: 360px;
  white-space: normal;
  font-family: var(--sans);
  color: var(--text);
}

.jobs-table .mono-cell,
.jobs-table .date-cell {
  white-space: nowrap;
  font-family: var(--mono);
  color: rgba(255, 255, 255, 0.82);
}

.jobs-table .numeric-cell {
  text-align: right;
}

.job-status-cell {
  white-space: nowrap;
  font-family: var(--mono);
  font-weight: 700;
}

.job-status-cell.status-running {
  color: #86efac;
}

.job-status-cell.status-paused,
.job-status-cell.status-ready,
.job-status-cell.status-new {
  color: #fde68a;
}

.job-status-cell.status-stopped {
  color: #fca5a5;
}

.job-table-actions {
  flex-wrap: nowrap;
}

.compact-action {
  min-height: 0;
  padding: 5px 7px;
  font-size: 12px;
}

.discovery-card-title {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  color: var(--text);
  font-weight: 650;
}

.metrics-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.metric-pill {
  display: inline-flex;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 12px;
}

.category-tree-view {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.category-tree-view[hidden] {
  display: none;
}

.category-tree-summary,
.category-tree-empty {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 13px;
}

.category-tree-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}

.category-tree-summary-text {
  flex: 1 1 220px;
  min-width: 0;
  line-height: 1.45;
}

.category-tree-summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex: 1 1 280px;
}

.category-export-controls {
  grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr) minmax(120px, 1fr) minmax(220px, 2fr);
}

.category-exports-table th,
.category-exports-table td {
  padding: 6px 7px;
  font-size: 12px;
  vertical-align: middle;
}

.category-exports-table td:nth-child(4),
.category-exports-table td:nth-child(5) {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-export-file-cell {
  width: 72px;
  white-space: nowrap;
}

.category-export-file-btn {
  padding: 4px 7px;
  min-height: 0;
  font-family: var(--mono);
  font-size: 12px;
}

.category-export-actions {
  flex-wrap: nowrap;
  gap: 4px;
}

.category-export-actions button {
  padding: 4px 6px;
  min-height: 0;
  font-size: 11px;
  line-height: 1.2;
}

.category-tree-list {
  display: grid;
  gap: 12px;
  overflow-x: auto;
  padding: 2px 2px 8px;
}

.category-tree-node {
  position: relative;
  display: grid;
  gap: 6px;
  min-width: 220px;
}

.category-tree-node:not(.root) {
  padding-left: 18px;
}

.category-tree-node:not(.root)::before {
  content: "";
  position: absolute;
  top: 17px;
  left: 0;
  width: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.24);
}

.category-tree-node:not(.root)::after {
  content: "";
  position: absolute;
  top: 13px;
  left: 10px;
  width: 7px;
  height: 7px;
  border-top: 1px solid rgba(255, 255, 255, 0.34);
  border-right: 1px solid rgba(255, 255, 255, 0.34);
  transform: rotate(45deg);
}

.category-tree-children {
  display: grid;
  gap: 8px;
  margin-left: 18px;
  padding-left: 16px;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
}

.category-tree-card {
  display: inline-flex;
  width: fit-content;
  max-width: min(100%, 360px);
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
}

.category-tree-card-head {
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.category-tree-card-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.category-tree-card-actions {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  flex: 0 0 auto;
}

.category-tree-toggle,
.category-tree-card-actions button {
  min-height: 24px;
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 11px;
}

.category-tree-toggle {
  min-width: 24px;
  flex: 0 0 auto;
}

/* TODO: remove category navigation after experiments. Browser styles are kept as disabled route reserve. */
.category-browser {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.category-browser[hidden] {
  display: none;
}

.category-path {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
}

.category-path button {
  padding: 5px 7px;
  border-radius: 9px;
  font-size: 12px;
}

.browser-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.browser-head h3 {
  margin: 0 0 5px;
  font-size: 15px;
}

.summary.compact {
  margin-top: 12px;
  font-size: 13px;
}

.heartbeat-line {
  display: block;
}

.hb-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hb-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
}

.hb-dot.ok {
  background: rgba(34, 197, 94, 0.95);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.22);
}

.hb-dot.warn {
  background: rgba(250, 204, 21, 0.95);
  box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.22);
}

.hb-dot.stale {
  background: rgba(251, 113, 133, 0.95);
  box-shadow: 0 0 0 2px rgba(251, 113, 133, 0.22);
}

.divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 6px 0 2px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.actions.slim {
  margin-top: 0;
}

button {
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 650;
}

button:hover {
  background: rgba(255, 255, 255, 0.1);
}

button.primary {
  border-color: rgba(124, 58, 237, 0.55);
  background: linear-gradient(180deg, rgba(124, 58, 237, 0.95), rgba(124, 58, 237, 0.65));
}

button.primary:hover {
  filter: brightness(1.05);
}

button.secondary {
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.12);
}

button.ghost {
  background: transparent;
}

button.danger {
  border-color: rgba(251, 113, 133, 0.45);
  color: rgba(255, 210, 216, 0.95);
}

.summary {
  margin: 0 0 12px;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  line-height: 1.45;
}

.diagnostics {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  line-height: 1.5;
  font-size: 13px;
}

.status {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
  min-height: 1.4em;
}

.table-controls {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  margin: 0 0 12px;
}

.exports-filters {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.sort-btn {
  all: unset;
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  max-width: 100%;
  box-sizing: border-box;
}

.sort-btn:hover {
  color: #fff;
}

.sort-btn-label {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.sort-header-indicators {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.sort-triangle-filled {
  font-size: 11px;
  line-height: 1;
  color: var(--accent-2);
}

.sort-triangle-outline {
  font-size: 10px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.38);
}

@media (max-width: 980px) {
  .table-controls {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .table-controls {
    grid-template-columns: 1fr;
  }
}

.inline-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.cookie-consent {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  background: rgba(10, 16, 28, 0.94);
  backdrop-filter: blur(16px);
  box-shadow: 0 -10px 48px rgba(0, 0, 0, 0.4);
}

.cookie-consent-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
}

.cookie-consent-text {
  margin: 0;
  flex: 1;
  min-width: min(100%, 260px);
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

.cookie-consent-text a {
  color: rgba(147, 197, 253, 0.95);
  text-decoration: underline;
  text-underline-offset: 3px;
  word-break: break-all;
}

.cookie-consent-text a:hover {
  color: rgba(255, 255, 255, 0.95);
}

.cookie-consent-accept {
  flex-shrink: 0;
}

body.cookie-consent-visible .floating-nav {
  bottom: calc(140px + env(safe-area-inset-bottom, 0px));
}

.floating-nav {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 8px;
  z-index: 40;
}

.floating-btn {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: rgba(10, 16, 28, 0.85);
  backdrop-filter: blur(8px);
}

.table-wrap {
  overflow: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
}

#analysisReportTable .report-file-link {
  color: var(--accent-2);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  word-break: break-all;
}

#analysisReportTable .report-file-link:hover {
  color: rgba(147, 197, 253, 0.95);
}

.analysis-article-preview-header {
  flex-wrap: wrap;
  gap: 12px;
}

.analysis-article-preview-header .actions {
  flex-shrink: 0;
}

.analysis-article-preview-meta {
  margin: 0 0 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.analysis-article-preview-note {
  margin: 0 0 10px;
}

.analysis-report-header {
  flex-wrap: wrap;
  gap: 12px;
}

.analysis-report-header .actions {
  flex-shrink: 0;
}

button.report-metric-btn {
  width: 100%;
  margin: 0;
  padding: 6px 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: inherit;
  cursor: pointer;
  transition: background 0.15s ease;
}

button.report-metric-btn:hover {
  background: rgba(147, 197, 253, 0.12);
}

button.report-metric-btn:focus-visible {
  outline: 2px solid rgba(147, 197, 253, 0.65);
  outline-offset: 1px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1100px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(10, 16, 28, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
  padding: 12px 10px;
  white-space: nowrap;
}

tbody td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px;
  vertical-align: top;
  font-size: 13px;
}

tbody tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.mono {
  font-family: var(--mono);
  font-size: 12px;
}

.link {
  color: rgba(167, 139, 250, 0.95);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.row-lagging td {
  background: rgba(251, 113, 133, 0.08);
}

.row-ahead td {
  background: rgba(34, 197, 94, 0.08);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

.badge.warn {
  border-color: rgba(251, 113, 133, 0.35);
  color: rgba(255, 255, 255, 0.86);
}

.badge.ok {
  border-color: rgba(34, 197, 94, 0.35);
  color: rgba(255, 255, 255, 0.86);
}

.badge.neutral {
  border-color: rgba(255, 255, 255, 0.18);
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.55);
  z-index: 50;
}

.modal.open {
  display: flex;
}

.modal-card {
  width: min(980px, 100%);
  max-height: min(80vh, 900px);
  overflow: auto;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(10, 16, 28, 0.92);
  box-shadow: var(--shadow);
  padding: 14px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
}

.modal pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.86);
}

/* Markdown в модальном окне «Как пользоваться» */
.howto-body {
  margin: 0;
  padding: 4px 2px 10px;
  font-size: 13px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.88);
}

.howto-body > :first-child {
  margin-top: 0;
}

.howto-body > :last-child {
  margin-bottom: 0;
}

.howto-body h1 {
  margin: 0 0 0.55em;
  font-size: 1.25rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.howto-body h2 {
  margin: 1.15em 0 0.45em;
  font-size: 1.05rem;
  font-weight: 600;
}

.howto-body h3 {
  margin: 1em 0 0.35em;
  font-size: 0.98rem;
  font-weight: 600;
}

.howto-body p {
  margin: 0 0 0.65em;
}

.howto-body ul,
.howto-body ol {
  margin: 0 0 0.65em;
  padding-left: 1.35em;
}

.howto-body li {
  margin: 0.25em 0;
}

.howto-body blockquote {
  margin: 0.65em 0;
  padding: 0.35em 0 0.35em 0.85em;
  border-left: 3px solid rgba(96, 165, 250, 0.45);
  color: rgba(255, 255, 255, 0.82);
}

.howto-body hr {
  margin: 1em 0;
  border: none;
  border-top: 1px solid var(--border);
}

.howto-body a {
  color: rgba(147, 197, 253, 0.98);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.howto-body a:hover {
  color: rgba(191, 219, 254, 1);
}

.howto-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.65em 0 0.85em;
  font-size: 12px;
}

.howto-body thead th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  font-weight: 600;
}

.howto-body td {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  vertical-align: top;
}

.howto-body tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

.howto-body code {
  font-family: var(--mono);
  font-size: 0.92em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
}

.howto-body pre {
  margin: 0.65em 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
  overflow-x: auto;
}

.howto-body pre code {
  padding: 0;
  background: none;
  font-size: 12px;
}

.howto-loading {
  margin: 0;
  color: rgba(255, 255, 255, 0.55);
}

.howto-error {
  margin: 0;
  color: rgba(248, 113, 113, 0.95);
}
