:root {
  --bg: #0f1419;
  --card: #1a2332;
  --text: #e7ecf3;
  --muted: #9aa7b8;
  --accent: #3b82f6;
  --danger: #ef4444;
  --ok: #22c55e;
  --border: #2d3a4d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.header {
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
}

.header h1 { margin: 0 0 0.25rem; font-size: 1.5rem; }
.subtitle { margin: 0; color: var(--muted); font-size: 0.95rem; }

.page {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.25rem 2rem 2rem;
  max-width: 1600px;
  margin: 0 auto;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
}

.card h2 { margin: 0; font-size: 1.15rem; }

.runs-panel {
  display: flex;
  flex-direction: column;
}

.runs-panel:not(.collapsed) {
  min-height: min(72vh, 820px);
}

.runs-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.runs-bar-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.runs-chevron {
  font-size: 0.75rem;
  color: var(--muted);
  transition: transform 0.2s;
}

.runs-panel.collapsed .runs-chevron {
  transform: rotate(-90deg);
}

.runs-panel.collapsed .runs-body {
  display: none;
}

.runs-panel:not(.collapsed) .runs-bar {
  margin-bottom: 1rem;
}

.runs-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.runs-launch {
  flex-shrink: 0;
  margin-bottom: 0;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
}

.runs-launch-left {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.runs-launch-title {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.runs-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: stretch;
  gap: 0.75rem 1rem;
  height: 13rem;
  min-height: 13rem;
  max-height: 13rem;
  box-sizing: border-box;
}

.runs-header .active-runs-list {
  min-width: 0;
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
}

.runs-controls {
  flex: 0 0 300px;
  width: 300px;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  box-sizing: border-box;
}

.runs-controls-title {
  visibility: hidden;
  user-select: none;
  pointer-events: none;
}

.runs-controls-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.45rem;
}

.runs-controls-main {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
}

.runs-controls-picker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.runs-controls-picker select {
  flex: 1;
  min-width: 0;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #111827;
  color: var(--text);
}

.runs-start-btn,
.runs-schedule-btn,
.runs-grafana-btn {
  width: 100%;
  box-sizing: border-box;
}

.section-label {
  margin: 0.75rem 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.badge {
  display: inline-block;
  min-width: 1.75rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
  flex-shrink: 0;
}

.scheduled-panel {
  margin: 0;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.scheduled-panel.is-pending .scheduled-body {
  display: none;
}
.scheduled-panel .scheduled-bar {
  width: 100%;
}
.scheduled-panel:not(.collapsed) .scheduled-bar {
  margin-bottom: 0.45rem;
}
.scheduled-panel.collapsed .scheduled-body {
  display: none;
}
.scheduled-panel.collapsed .scheduled-bar .runs-chevron {
  transform: rotate(-90deg);
}
.scheduled-body {
  min-height: 0;
}
.scheduled-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 10.5rem;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.15rem;
}
.scheduled-panel:not(.collapsed) .scheduled-list:has(.empty-hint:only-child) {
  max-height: 2.75rem;
  overflow: hidden;
}
.scheduled-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #111827;
  font-size: 0.88rem;
}
.scheduled-row-info {
  flex: 1;
  min-width: 180px;
}
.scheduled-row .btn.danger {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}
.scheduled-row-meta {
  font-size: 0.8rem;
  color: var(--muted, #9ca3af);
}
.settings-form select {
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #111827;
  color: var(--text);
  font-size: 0.9rem;
}

.active-runs-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.runs-header .active-runs-list:has(.empty-hint) {
  overflow-y: hidden;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Один прогон — карточка на всю высоту, без скролла */
.runs-header .active-runs-list:has(> .run-row:only-child) > .run-row {
  flex: 0 0 auto;
  min-height: unset;
}

.run-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  width: 100%;
  flex: 0 0 auto;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #111827;
  cursor: pointer;
  transition: border-color 0.15s;
}

.run-row:hover { border-color: #4b5563; }
.run-row.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.run-row-info {
  flex: 1;
  min-width: 200px;
  font-size: 0.88rem;
  line-height: 1.45;
}

.run-row-info strong { color: var(--text); }

.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-top: 0.65rem;
  flex-wrap: wrap;
}

.log-header .section-label {
  margin: 0;
}

.log-header-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.log-summary-link {
  color: #93c5fd;
  text-decoration: none;
}

.log-summary-link:hover {
  text-decoration: underline;
}

.log-header-actions .log-header-meta {
  min-width: 0;
  text-align: right;
}

.section-search {
  min-width: 0;
}

.results-search {
  width: min(22rem, 100%);
  min-width: 12rem;
  justify-self: end;
}

.section-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #111827;
  color: var(--text);
  font-size: 0.88rem;
}

.section-search-input::placeholder {
  color: var(--muted);
}

.section-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.section-search-input::-webkit-search-cancel-button {
  cursor: pointer;
}

.log-view {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.log-view.hidden {
  display: none;
}

.log-block-head {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}

.log-block-title,
.log-block-head .log-errors-title {
  font-size: 0.92rem;
  font-weight: 600;
  margin: 0;
  flex: 0 1 auto;
  min-width: 0;
}

.log-block-search {
  width: min(22rem, 100%);
  min-width: 12rem;
  flex-shrink: 0;
  margin-left: auto;
}

.log-scroll-panel {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0b1220;
  box-sizing: border-box;
}

.log-stdout-panel {
  height: 11rem;
  min-height: 11rem;
  max-height: 11rem;
}

.log-stdout-panel .log-stdout {
  min-height: 100%;
  max-height: none;
  height: auto;
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.log-summary {
  flex-shrink: 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #111827;
}

.log-summary.hidden {
  display: none;
}

.log-summary-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.65rem;
}

.log-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: 0.5rem 0.75rem;
}

.log-summary-grid-pending .log-stat-value {
  color: var(--muted);
  font-weight: 500;
}

.log-stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.log-stat-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.log-stat-value {
  font-size: 0.95rem;
  font-weight: 600;
}

.log-stat-value.warn {
  color: #fbbf24;
}

.log-stat-value.err {
  color: #f87171;
}

.log-summary-note {
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.log-summary-note-err {
  color: #fca5a5;
}

.log-stdout-block.hidden {
  display: none;
}

.log-errors-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.log-errors-section.hidden {
  display: none;
}

.log-errors-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
}

.log-errors-meta {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.log-empty-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 8rem;
  margin: 0.5rem 0 0;
  width: 100%;
  text-align: center;
  box-sizing: border-box;
}

.log-empty-hint.hidden {
  display: none;
}

.log-errors-panel.log-errors-table-wrap {
  height: 12.5rem;
  min-height: 12.5rem;
  max-height: 12.5rem;
}

.log-errors-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  line-height: 1.4;
}

.log-errors-table th,
.log-errors-table td {
  padding: 0.5rem 0.65rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.log-errors-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #111827;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.log-errors-table tbody tr:last-child td {
  border-bottom: none;
}

.log-errors-table .col-datetime {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: #94a3b8;
  font-size: 0.78rem;
}

.log-errors-table .col-assertion {
  white-space: nowrap;
  font-weight: 600;
  color: #fca5a5;
}

.log-errors-table .col-detail {
  color: #94a3b8;
  min-width: 12rem;
  max-width: 42rem;
  word-break: break-word;
  white-space: pre-wrap;
  font-size: 0.78rem;
  line-height: 1.45;
}

.log-errors-table .col-label {
  font-weight: 500;
  max-width: 14rem;
  word-break: break-word;
}

.log-errors-table-empty td {
  color: var(--muted);
  text-align: center;
  padding: 1.25rem;
}

.log {
  flex: 1;
  min-height: 120px;
  max-height: calc(72vh - 280px);
  overflow: auto;
  background: #0b1220;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #cbd5e1;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.results-panel .results-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.65rem 0.75rem;
  margin-bottom: 0;
}

.results-panel .results-toggle {
  justify-self: start;
}

.results-panel .results-header-actions {
  justify-self: center;
  grid-column: 2;
}

.results-panel .results-header-right {
  grid-column: 3;
  justify-self: end;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: nowrap;
  min-width: 0;
}

.results-panel .results-delete-all-btn {
  flex-shrink: 0;
  white-space: nowrap;
  order: 1;
}

.results-panel .results-header-right .results-search {
  justify-self: unset;
  order: 2;
  flex-shrink: 1;
  min-width: 12rem;
}

.results-panel:not(.collapsed) .results-header {
  margin-bottom: 1rem;
}

.results-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.results-toggle h2 {
  margin: 0;
  font-size: 1.15rem;
  white-space: nowrap;
  min-width: 9.5rem;
  font-variant-numeric: tabular-nums;
}

.results-chevron {
  font-size: 0.75rem;
  color: var(--muted);
  transition: transform 0.2s;
}

.results-panel.collapsed .results-chevron {
  transform: rotate(-90deg);
}

.results-panel.collapsed .results-body {
  display: none;
}

.results-header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.btn-subtle {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 400;
  padding: 0.2rem 0.35rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  opacity: 0.75;
}

.btn-subtle:hover {
  color: var(--text);
  opacity: 1;
}

.btn-subtle:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.danger { background: var(--danger); color: #fff; padding: 0.4rem 0.75rem; font-size: 0.82rem; }
.btn.secondary { background: #334155; color: #fff; }
.btn.icon {
  background: #334155;
  color: #fff;
  padding: 0.55rem 0.75rem;
  font-size: 1.15rem;
  line-height: 1;
}
.btn.icon:hover { background: #475569; }

.modal.hidden { display: none; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}
.modal-panel {
  position: relative;
  width: min(480px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.modal-header h2 { margin: 0; font-size: 1.15rem; }
.modal-close {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-hint {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.modal-hint code {
  font-size: 0.82rem;
  background: #111827;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.settings-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.88rem;
}
.settings-form label > span:first-child {
  font-weight: 600;
  color: var(--text);
}
.settings-form input:not([type="checkbox"]):not([type="radio"]) {
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #111827;
  color: var(--text);
  font-size: 0.9rem;
}

.hidden {
  display: none !important;
}

/* Форма расписания — после общих .settings-form label */
#scheduleForm .schedule-type-fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 0;
  padding: 0.65rem 0.85rem 0.75rem;
}
#scheduleForm .schedule-type-fieldset legend {
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0 0.25rem;
}
#scheduleForm .schedule-type-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  margin-top: 0.35rem;
}
#scheduleForm label.schedule-type-option {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.45rem;
  width: auto;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 400;
  cursor: pointer;
}
#scheduleForm label.schedule-type-option > span {
  font-weight: 500;
}
#scheduleForm label.schedule-type-option input[type="radio"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  flex-shrink: 0;
  accent-color: var(--accent);
}
#scheduleForm .schedule-weekdays {
  margin-top: 0.25rem;
}
#scheduleForm .schedule-weekdays-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
#scheduleForm .schedule-weekdays-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
}
#scheduleForm label.weekday-chip {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  width: 100%;
  margin: 0;
  padding: 0.4rem 0.2rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  background: #111827;
}
#scheduleForm label.weekday-chip:has(input:checked) {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.15);
}
#scheduleForm label.weekday-chip input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  flex-shrink: 0;
  accent-color: var(--accent);
}
#scheduleForm label.weekday-chip > span {
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

#scheduleDateTime::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.45;
  filter: invert(1) brightness(1.1);
}

#scheduleDateTime:hover::-webkit-calendar-picker-indicator,
#scheduleDateTime:focus::-webkit-calendar-picker-indicator {
  opacity: 0.85;
  filter: invert(1) brightness(1.45);
}

.field-hint {
  font-size: 0.8rem;
  color: var(--muted);
}
.field-hint code {
  font-size: 0.78rem;
  background: #111827;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.meta { color: var(--muted); font-size: 0.85rem; }
.empty-hint {
  margin: 0;
  width: 100%;
  text-align: center;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 4.5rem;
}

.results-list.results-list--empty {
  align-items: center;
  justify-content: center;
}

.results-body.is-loading .results-list {
  min-height: 4.5rem;
}

.log-errors-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 0.75rem;
  margin-top: 0.5rem;
}

.pagination-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88rem;
  white-space: nowrap;
}

.pagination-page-input {
  width: 3.25rem;
  padding: 0.3rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #111827;
  color: var(--text);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
  -moz-appearance: textfield;
}

.pagination-page-input::-webkit-outer-spin-button,
.pagination-page-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.pagination-page-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.pagination-nav-edge {
  min-width: 2.1rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.log-errors-pagination.hidden {
  display: none;
}

.results-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.results-pagination.hidden {
  display: none;
}

.results-pagination.idle {
  visibility: hidden;
  pointer-events: none;
}

.pagination-pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  max-width: 100%;
}

.pagination-nav {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #334155;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.pagination-nav:hover:not(:disabled) {
  background: #475569;
}

.pagination-nav:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pagination-page {
  min-width: 2.1rem;
  height: 2.1rem;
  padding: 0 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #111827;
  color: var(--text);
  font-size: 0.88rem;
  cursor: pointer;
}

.pagination-page:hover {
  border-color: #4b5563;
}

.pagination-page.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: default;
}

.result-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  background: #111827;
}

.result-item h3 { margin: 0 0 0.35rem; font-size: 0.95rem; }
.summary { font-size: 0.85rem; margin-bottom: 0.5rem; }
.result-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.link-btn {
  display: inline-block;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  background: #1e3a5f;
  color: #93c5fd;
  text-decoration: none;
  font-size: 0.82rem;
}

.toast {
  position: fixed;
  left: 50%;
  top: 1.25rem;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  max-width: min(42rem, 92vw);
  padding: 0.65rem 0.65rem 0.65rem 1rem;
  background: #1e3a5f;
  border: 1px solid #3b82f6;
  border-radius: 8px;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.toast.hidden { display: none; }

.toast-message {
  flex: 1;
  text-align: center;
  line-height: 1.45;
  padding: 0.15rem 0;
}

.toast-close {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: inherit;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.75;
  padding: 0 0.15rem;
}

.toast-close:hover {
  opacity: 1;
}

.toast.error {
  background: #3f1d1d;
  border-color: var(--danger);
  color: #fecaca;
}

/* —— История прогонов —— */
.history-panel.collapsed .history-body {
  display: none;
}

.history-panel.collapsed .history-chevron,
.history-panel.collapsed .results-chevron {
  transform: rotate(-90deg);
}

.history-panel:not(.collapsed) .history-header {
  margin-bottom: 0.75rem;
}

.history-panel.collapsed .history-header {
  margin-bottom: 0;
}

.history-panel .history-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.65rem 0.75rem;
}

.history-panel .history-header .results-toggle {
  justify-self: start;
  min-width: 0;
}

.history-panel .history-header-actions {
  justify-self: center;
  grid-column: 2;
}

.history-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.25rem;
  align-items: flex-end;
  margin-bottom: 0.75rem;
}

.history-filter-label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.history-filters select {
  min-width: 160px;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.history-summary {
  margin: 0 0 0.75rem;
}

.history-warn {
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid rgba(234, 179, 8, 0.35);
  color: #fde68a;
  font-size: 0.9rem;
}

.history-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.history-chart-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  background: var(--bg);
}

.history-chart-title {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.history-chart {
  min-height: 180px;
}

.history-chart-svg {
  width: 100%;
  height: auto;
  display: block;
}

.history-chart-grid {
  stroke: var(--border);
  stroke-width: 1;
}

.history-chart-axis {
  fill: var(--muted);
  font-size: 10px;
}

.history-chart-dot.ok {
  fill: var(--ok);
}

.history-chart-dot.fail {
  fill: var(--danger);
}

.history-chart-dot.baseline {
  fill: #fbbf24;
  stroke: #f59e0b;
  stroke-width: 2;
}

.history-table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0b1220;
  box-sizing: border-box;
  height: 12.5rem;
  min-height: 12.5rem;
  max-height: 12.5rem;
}

.history-table-empty {
  margin: 0;
  padding: 0.75rem;
}

.history-table-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.35rem 1rem;
  margin-top: 0.5rem;
}

.history-table-footer .log-errors-pagination {
  grid-column: 2;
  margin-top: 0;
  justify-self: center;
}

.history-table-range {
  grid-column: 1;
  margin: 0;
  justify-self: start;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.history-table th,
.history-table td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.history-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  font-weight: 600;
  background: #111827;
}

.history-verdict.ok {
  color: var(--ok);
}

.history-verdict.fail {
  color: var(--danger);
}

.history-col-stable-rps {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.history-run-id {
  font-size: 0.75rem;
  color: var(--muted);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-table-row {
  cursor: pointer;
}

.history-table-row.is-baseline td {
  background: rgba(251, 191, 36, 0.08);
}

.history-table-row.is-selected td {
  background: rgba(59, 130, 246, 0.12);
}

.history-table-row.is-baseline.is-selected td {
  background: rgba(59, 130, 246, 0.16);
}

.history-col-star {
  width: 2.5rem;
  text-align: center;
}

.history-baseline-btn {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.15rem 0.35rem;
}

.history-baseline-btn:hover,
.history-baseline-btn.active {
  color: #fbbf24;
}

.history-delta {
  font-size: 0.82rem;
  white-space: nowrap;
}

.history-delta.worse {
  color: var(--danger);
}

.history-delta.better {
  color: var(--ok);
}

.history-compare-ref {
  margin: 0 0 0.5rem;
}

.history-table-row:hover td {
  background: rgba(255, 255, 255, 0.04);
}

.history-table-row.is-selected:hover td {
  background: rgba(59, 130, 246, 0.18);
}

.history-selection-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.08);
}

.history-selection-bar.hidden {
  display: none;
}

.history-selection-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.history-compare-hint {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
}

.history-compare-result {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  min-width: 0;
  max-width: 100%;
}

.history-panel.is-compare-active .history-compare-inner {
  max-width: 100%;
  min-width: 0;
}

.history-panel.is-compare-active .history-compare-result {
  overflow-x: auto;
}

.history-panel.is-compare-active .history-compare-table {
  width: 100%;
  table-layout: fixed;
  --compare-metric-col: 7rem;
}

.history-panel.is-compare-active .history-compare-table th:first-child,
.history-panel.is-compare-active .history-compare-table td:first-child {
  width: var(--compare-metric-col);
  min-width: var(--compare-metric-col);
  white-space: nowrap;
}

.history-panel.is-compare-active .history-compare-table th:not(:first-child),
.history-panel.is-compare-active .history-compare-table td:not(:first-child) {
  width: calc((100% - var(--compare-metric-col)) / var(--compare-cols, 4));
  max-width: 0;
}

.history-compare-col-date {
  display: block;
  font-weight: 600;
  white-space: nowrap;
}

.history-compare-col-run-id {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.72rem;
  line-height: 1.3;
  font-weight: 400;
  color: var(--muted);
  word-break: break-all;
  overflow-wrap: anywhere;
}

.history-panel.is-compare-active .history-compare-table th,
.history-panel.is-compare-active .history-compare-table td {
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.history-compare-table .history-delta {
  display: block;
  font-size: 0.78rem;
  margin-top: 0.12rem;
  white-space: nowrap;
}

.history-compare-errors-row th {
  vertical-align: top;
  color: var(--muted);
  font-weight: 600;
}

.history-compare-errors-row td {
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.history-compare-errors-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
}

.history-compare-errors-list code {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.history-compare-errors-cell .history-compare-links {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
}

.history-compare-errors-cell .history-compare-links a {
  color: var(--accent);
}

.history-compare-inner {
  min-width: 0;
}

.history-compare-result.hidden {
  display: none;
}

.history-compare-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.history-compare-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.history-compare-table th,
.history-compare-table td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.65rem;
  text-align: left;
  vertical-align: top;
}

.history-compare-links a {
  color: var(--accent);
}

@media (max-width: 768px) {
  .page { padding: 1rem; }
  .log { min-height: 280px; }
}
