/* Ракурс · концепция «Атлас»
   Книжные выводы, точная служебная типографика и один дозированный синий. */

:root {
  --ink: #171b21;
  --muted: #5c6570;
  --muted-2: #98a2ae;
  --line: #dce2e9;
  --line-strong: #aab4c0;
  --paper: #eff2f5;
  --surface: #ffffff;
  --surface-soft: #f7f9fb;
  --navy: #171b21;
  --navy-soft: #2d333b;
  --blue: #2b55d6;
  --blue-dark: #1c3da8;
  --blue-soft: #e8eefc;
  --green: #237a52;
  --green-soft: #e7f3ed;
  --amber: #b7791f;
  --amber-soft: #f8efdf;
  --red: #b94a3d;
  --red-soft: #faebe8;
  --shadow: none;
  --font-display: "Literata", Georgia, serif;
  --font-body: "Golos Text", system-ui, sans-serif;
  --font-data: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

html,
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: #d9e2f8;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline-color: rgba(43, 85, 214, 0.36);
}

.rakurz-lockup {
  display: inline-grid;
  grid-template-columns: 15px auto;
  align-items: center;
  column-gap: 8px;
  color: var(--ink);
  text-align: left;
}

.rakurz-corner {
  width: 13px;
  height: 13px;
  align-self: center;
  border-top: 3px solid var(--blue);
  border-left: 3px solid var(--blue);
}

.rakurz-wordmark {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1;
}

.rakurz-descriptor {
  grid-column: 2;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.2;
}

/* Автономный сценарий */

.run-shell {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--paper);
}

.run-shell::before {
  display: none;
}

.run-header {
  position: absolute;
  z-index: 2;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  min-height: 88px;
  align-items: center;
  justify-content: space-between;
  padding: 25px clamp(24px, 5vw, 72px);
  border-bottom: 1px solid rgba(220, 226, 233, 0.78);
  background: rgba(239, 242, 245, 0.9);
  backdrop-filter: blur(14px);
}

.run-header .rakurz-wordmark {
  font-size: 24px;
}

.run-header .rakurz-descriptor {
  font-size: 10px;
}

.run-domain {
  color: var(--muted);
  font-family: var(--font-data);
  font-size: 10px;
}

.run-main {
  min-height: 100vh;
  min-height: 100dvh;
  align-items: center;
  justify-items: center;
  padding: 132px clamp(24px, 5vw, 72px) 68px;
}

.run-card {
  width: min(1040px, 100%);
  align-items: flex-start;
  text-align: left;
}

.run-kicker {
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.run-card h1,
.run-card--idle h1,
.run-card--benchmarks h1,
.run-card--discovering h1 {
  max-width: 850px;
  margin: 13px 0 0;
  font-family: var(--font-display);
  font-size: clamp(43px, 6vw, 72px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.04;
  text-align: left;
  text-wrap: balance;
}

.run-lede {
  max-width: 760px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.58;
  text-align: left;
  text-wrap: pretty;
}

.run-card--idle,
.run-card--benchmarks {
  width: min(1040px, 100%);
}

.start-site-form {
  width: min(820px, 100%);
  margin-top: 32px;
  padding: 6px;
  grid-template-columns: minmax(0, 1fr) 220px;
  border-color: var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: none;
}

.start-site-input input {
  height: 58px;
  color: var(--ink);
  font-size: 16px;
}

.start-site-form .run-primary {
  min-height: 58px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
}

.atlas-value-grid {
  display: grid;
  width: 100%;
  margin-top: 42px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.atlas-value-grid > div {
  display: grid;
  gap: 7px;
  padding: 20px 28px 21px 0;
}

.atlas-value-grid > div + div {
  padding-left: 28px;
  border-left: 1px solid var(--line);
}

.atlas-value-grid strong {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
}

.atlas-value-grid span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.run-timing {
  margin: 15px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.run-primary {
  min-width: 230px;
  min-height: 56px;
  margin-top: 30px;
  border-radius: 8px;
  background: var(--blue);
  box-shadow: none;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
}

.run-primary:hover {
  background: var(--blue-dark);
  box-shadow: none;
}

.run-primary span {
  font-size: 18px;
}

.discovery-mark {
  height: 13px;
}

.discovery-mark i {
  width: 6px;
  height: 6px;
  background: var(--blue);
}

.run-card--discovering h1 {
  margin-top: 24px;
}

.discovery-domain {
  margin-top: 24px;
  color: var(--muted);
  font-size: 10px;
}

.run-card--benchmarks {
  padding-top: 8px;
}

.run-card--benchmarks > .run-kicker {
  margin-left: 74px;
}

.run-back {
  top: 3px;
  width: 44px;
  height: 44px;
  border-color: var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.run-card--benchmarks h1,
.run-card--benchmarks > .run-lede {
  align-self: stretch;
  padding-left: 74px;
  text-align: left;
}

.run-card--benchmarks h1 {
  font-size: clamp(36px, 5vw, 58px);
}

.benchmark-subject {
  margin-top: 28px;
  padding: 15px 18px;
  grid-template-columns: 110px 1fr auto;
  border-color: var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.62);
}

.benchmark-subject > span,
.benchmark-list legend {
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.benchmark-subject strong {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
}

.benchmark-option {
  min-height: 122px;
  border-color: var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.benchmark-option:has(input:checked) {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px var(--blue);
}

.benchmark-option__check {
  border-radius: 50%;
}

.custom-benchmark-form {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.46);
}

.run-card--running,
.run-card--blocked,
.run-card--complete {
  width: min(900px, 100%);
}

.run-card--running h1,
.run-card--blocked h1,
.run-card--complete h1 {
  max-width: 820px;
  font-size: clamp(38px, 5vw, 58px);
}

.run-orbit {
  width: 64px;
  height: 64px;
  margin-bottom: 22px;
  border-color: var(--line);
  border-radius: 12px;
}

.run-orbit::before,
.run-orbit::after {
  border-color: var(--line);
  border-radius: 8px;
}

.run-orbit::before {
  inset: 7px;
}

.run-orbit::after {
  inset: 15px;
}

.run-orbit b {
  font-size: 14px;
}

.run-current,
.run-message,
.run-reason,
.run-recommendation {
  max-width: 760px;
  color: var(--muted);
  text-align: left;
}

.run-progress,
.run-footprint {
  width: min(760px, 100%);
}

.run-progress__track {
  height: 5px;
  background: #dce2e9;
}

.run-footprint {
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.run-footprint__row {
  font-size: 11px;
}

.run-footprint__row i {
  width: 22px;
  height: 6px;
}

.run-card--blocked {
  padding: 36px 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.run-card--blocked .run-kicker {
  color: var(--blue);
}

.run-url {
  width: min(760px, 100%);
}

.run-browser-note {
  max-width: 620px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.run-card--managed-browser {
  width: min(1120px, 100%);
  padding: 32px 36px 28px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--blue);
  border-radius: 12px;
  background: var(--surface);
}

.run-card--managed-browser h1 {
  max-width: 100%;
  margin-top: 10px;
  font-size: clamp(32px, 4vw, 48px);
}

.run-card--managed-browser .run-reason,
.run-card--managed-browser .run-recommendation {
  max-width: 900px;
}

.managed-browser {
  width: 100%;
  margin-top: 24px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #e7ebf0;
  text-align: left;
}

.managed-browser__bar {
  display: grid;
  min-height: 46px;
  padding: 0 14px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 15px;
  border-bottom: 1px solid var(--line);
  background: #f8f9fb;
  color: var(--muted);
  font-size: 10px;
}

.managed-browser__bar > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-weight: 600;
}

.managed-browser__bar i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.managed-browser__bar code {
  overflow: hidden;
  font-family: var(--font-data);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.managed-browser__bar button,
.managed-browser__controls button {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 10px;
}

.managed-browser__viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #fff;
}

.managed-browser__viewport img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  cursor: crosshair;
  user-select: none;
  -webkit-user-drag: none;
}

.managed-browser__controls {
  display: grid;
  min-height: 52px;
  padding: 9px 12px;
  grid-template-columns: minmax(170px, 1fr) minmax(280px, 1.2fr) auto;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line);
  background: #f8f9fb;
  color: var(--muted);
  font-size: 10px;
}

.managed-browser__controls label {
  display: grid;
  grid-template-columns: 1fr auto;
}

.managed-browser__controls input {
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px 0 0 6px;
  background: #fff;
  font-size: 11px;
}

.managed-browser__controls label button {
  border-left: 0;
  border-radius: 0 6px 6px 0;
  color: var(--blue);
}

.managed-browser__controls > div {
  display: flex;
  gap: 5px;
}

.run-card--managed-browser .run-primary {
  margin-top: 22px;
}

.managed-browser__autoresume {
  display: inline-flex;
  margin: 18px 0 0;
  align-items: center;
  gap: 8px;
  color: var(--green);
  font-size: 11px;
}

.managed-browser__autoresume i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: run-pulse 1.2s ease-in-out infinite alternate;
}

.run-card--managed-browser .run-primary--fallback {
  min-height: 42px;
  margin-top: 10px;
  padding: 10px 16px;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-size: 11px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.run-card--managed-browser .run-primary--fallback:hover {
  transform: none;
  background: var(--surface-soft);
  box-shadow: none;
  color: var(--blue);
}

.run-card--managed-browser .run-progress {
  width: 100%;
}

@media (max-width: 760px) {
  .run-card--managed-browser {
    padding: 24px 16px;
  }

  .managed-browser__bar {
    grid-template-columns: 1fr auto;
  }

  .managed-browser__bar code {
    display: none;
  }

  .managed-browser__controls {
    grid-template-columns: 1fr;
  }
}

.run-summary {
  display: grid;
  width: 100%;
  margin-top: 30px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.run-summary > div {
  display: grid;
  gap: 2px;
  padding: 24px 28px;
}

.run-summary > div + div {
  border-left: 1px solid var(--line);
}

.run-summary strong {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
}

.run-summary span {
  color: var(--muted);
  font-size: 11px;
}

/* Исследовательская рабочая область */

.app-shell {
  grid-template-columns: 226px minmax(650px, 1fr);
}

.app-shell:has(.inspector) {
  grid-template-columns: 226px minmax(650px, 1fr) 306px;
}

.sidebar {
  padding: 24px 14px 18px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.brand {
  padding: 0 10px 25px;
  text-transform: none;
}

.brand .rakurz-descriptor {
  max-width: 150px;
}

.project-switcher {
  min-height: 76px;
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
}

.project-switcher:hover {
  border-color: var(--line-strong);
  background: var(--paper);
}

.project-switcher__label,
.project-switcher__chevron {
  color: var(--muted);
}

.nav {
  gap: 5px;
}

.nav__item {
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
}

.nav__item:hover {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
}

.nav__item.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.nav__item b {
  background: var(--amber);
}

.capture-status {
  border-color: var(--line);
}

.capture-status p,
.sidebar__footer {
  color: var(--muted);
}

.capture-status button {
  color: var(--blue);
}

.workspace,
.workspace__body {
  background: var(--paper);
}

.topbar {
  min-height: 96px;
  padding: 18px 25px;
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
}

.eyebrow,
.section-label {
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.topbar h1,
.panel-heading h2,
.next-step__copy h2,
.inspector__head strong,
.dialog__head h2 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.025em;
}

.topbar h1 {
  font-size: 28px;
}

.button {
  border-radius: 8px;
}

.button--primary {
  background: var(--blue);
  box-shadow: none;
}

.button--primary:hover {
  background: var(--blue-dark);
}

.button--quiet {
  border-color: var(--line);
  background: var(--surface);
}

.environment-chip {
  color: var(--muted);
  font-family: var(--font-data);
}

.workspace__body {
  padding: 24px;
}

.overview-view,
.compare-view,
.matrix-view,
.review-view,
.project-view {
  gap: 18px;
}

.overview-panel,
.next-step,
.metrics,
.coverage-map,
.finding-panel,
.source-panel,
.compare-toolbar,
.browser-frame,
.feature-legend,
.screen-meta,
.matrix-controls,
.matrix-table-wrap,
.review-card,
.project-card,
.inspector-tip,
.dialog form,
.dialog > div {
  border-color: var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: none;
}

.metric-card strong,
.overview-stat strong,
.finding-list > li > span {
  font-family: var(--font-display);
}

.next-step {
  overflow: hidden;
  border-top: 3px solid var(--blue);
  background: var(--surface);
}

.next-step::before {
  display: none;
}

.stage-rail {
  display: flex;
  overflow-x: auto;
  padding: 0;
  border: 0;
  gap: 8px;
  background: transparent;
}

.stage-rail__item {
  display: inline-flex;
  width: auto;
  min-width: max-content;
  padding: 8px 14px;
  grid-template-columns: auto auto;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  gap: 7px;
}

.stage-rail__item::after {
  display: none;
}

.stage-rail__number {
  width: auto;
  height: auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-data);
  font-size: 9px;
}

.stage-rail__item strong {
  font-size: 12px;
  font-weight: 500;
}

.stage-rail__item small {
  display: none;
}

.stage-rail__item.is-active {
  border-color: var(--ink);
  background: var(--ink);
}

.stage-rail__item.is-active strong,
.stage-rail__item.is-active .stage-rail__number {
  color: #fff;
}

.compare-toolbar {
  border: 1px solid var(--line);
}

.segmented {
  padding: 3px;
  border-color: var(--line);
  background: var(--surface-soft);
}

.segmented button.is-active {
  background: var(--ink);
  color: #fff;
}

.site-column__head {
  border-color: var(--line);
}

.site-identity > span {
  border-radius: 8px;
  background: var(--ink) !important;
}

.site-identity select {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
}

.capture-mode {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
}

.browser-frame {
  border: 1px solid var(--line-strong);
}

.browser-frame__bar {
  border-color: var(--line);
  background: var(--surface-soft);
}

.browser-url,
.browser-frame__mode {
  font-family: var(--font-data);
}

.feature-legend {
  border: 1px solid var(--line);
}

.feature-legend__head strong {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
}

.feature-legend__item > span {
  min-width: 30px;
  height: 22px;
  border-radius: 4px;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-data);
  font-size: 10px;
}

.feature-legend__item.is-active > span {
  background: var(--blue);
}

.feature-legend__item.is-active {
  color: var(--blue);
}

.screen-meta {
  border: 1px solid var(--line);
}

.screen-meta > div span {
  color: var(--muted);
}

.inspector {
  border-color: var(--line);
  background: var(--surface);
}

.inspector__head {
  border-color: var(--line);
}

.matrix-table th {
  background: var(--surface-soft);
}

.matrix-table th,
.matrix-table td,
.coverage-table th,
.coverage-table td {
  border-color: var(--line);
}

.dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(23, 27, 33, 0.16);
}

.dialog::backdrop {
  background: rgba(23, 27, 33, 0.42);
  backdrop-filter: blur(4px);
}

.toast {
  border-color: var(--line);
  border-left-color: var(--blue);
  border-radius: 10px;
  background: var(--ink);
}

@media (max-width: 1000px) {
  .app-shell,
  .app-shell:has(.inspector) {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  .inspector {
    display: none;
  }

  .atlas-value-grid {
    grid-template-columns: 1fr;
  }

  .atlas-value-grid > div,
  .atlas-value-grid > div + div {
    padding: 16px 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .atlas-value-grid > div:first-child {
    border-top: 0;
  }

  .benchmark-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body {
    overflow: auto;
  }

  .run-header {
    min-height: 76px;
    padding: 18px 20px;
  }

  .run-domain,
  .rakurz-descriptor {
    display: none;
  }

  .run-main {
    padding: 108px 20px 44px;
  }

  .run-card h1,
  .run-card--idle h1,
  .run-card--benchmarks h1,
  .run-card--discovering h1 {
    font-size: clamp(36px, 11vw, 52px);
  }

  .start-site-form {
    grid-template-columns: 1fr;
  }

  .start-site-form .run-primary {
    width: 100%;
  }

  .run-card--benchmarks > .run-kicker,
  .run-card--benchmarks h1,
  .run-card--benchmarks > .run-lede {
    padding-left: 0;
    margin-left: 0;
  }

  .run-back {
    position: static;
    margin-bottom: 18px;
  }

  .benchmark-list,
  .run-summary {
    grid-template-columns: 1fr;
  }

  .run-summary > div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .app-shell,
  .app-shell:has(.inspector) {
    display: block;
    height: auto;
  }

  .sidebar {
    position: sticky;
    z-index: 5;
    top: 0;
    display: block;
    padding: 13px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar .project-switcher,
  .sidebar .capture-status,
  .sidebar__footer,
  .sidebar__spacer {
    display: none;
  }

  .brand {
    padding: 0 0 11px;
  }

  .nav {
    overflow-x: auto;
    flex-direction: row;
    margin: 0;
  }

  .nav__item {
    min-width: max-content;
    padding: 8px 10px;
  }

  .workspace,
  .workspace__body {
    height: auto;
    overflow: visible;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar__actions {
    width: 100%;
    overflow-x: auto;
  }

  .workspace__body {
    padding: 16px;
  }
}
