/* ==========================================================================
   Страницы: обзор, продукты, мониторинг, сервер, настройки, вход
   ========================================================================== */

/* ---------- обзор ---------- */

.overview {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-4);
}

.kpi {
  min-height: 152px;
}

.bento {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--s-4);
}

.col-3 {
  grid-column: span 3;
}
.col-4 {
  grid-column: span 4;
}
.col-5 {
  grid-column: span 5;
}
.col-6 {
  grid-column: span 6;
}
.col-7 {
  grid-column: span 7;
}
.col-8 {
  grid-column: span 8;
}
.col-9 {
  grid-column: span 9;
}
.col-12 {
  grid-column: span 12;
}

.resource-foot {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  margin-top: var(--s-4);
  padding-top: var(--s-3);
  border-top: 1px solid var(--line-soft);
  font-size: var(--fs-11);
  color: var(--text-3);
  flex-wrap: wrap;
}

.resource-foot__item {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.resource-foot__item svg {
  width: 13px;
  height: 13px;
}

.resource-foot__value {
  color: var(--text-2);
  font-weight: 600;
}

.schedule {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  height: 100%;
}

.schedule__time {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  font-size: var(--fs-42);
  font-weight: 620;
  letter-spacing: -0.045em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.schedule__time span {
  font-size: var(--fs-13);
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0;
}

.schedule__next {
  font-size: var(--fs-12);
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.schedule__next svg {
  width: 14px;
  height: 14px;
  color: var(--accent);
}

.schedule__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding-top: var(--s-3);
  border-top: 1px solid var(--line-soft);
  font-size: var(--fs-12);
  color: var(--text-3);
}

.schedule__row strong {
  color: var(--text-2);
  font-weight: 600;
}

.tls-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.tls-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 74px;
  gap: var(--s-2) var(--s-3);
  align-items: center;
}

.tls-row__name {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-12);
  font-weight: 550;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tls-row__days {
  justify-self: end;
  font-size: var(--fs-11);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}

.tls-row__days.is-warn {
  color: var(--warning);
}

.tls-row__days.is-danger {
  color: var(--danger-bright);
}

.tls-row__bar {
  grid-column: 1 / -1;
  height: 4px;
  border-radius: 2px;
  background: var(--line-soft);
  overflow: hidden;
}

.tls-row__bar span {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--success);
  opacity: 0.75;
}

.tls-row__bar.is-warn span {
  background: var(--warning);
}

.tls-row__bar.is-danger span {
  background: var(--danger-bright);
}

/* ---------- продукты ---------- */

.products-toolbar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
}

.filters {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar {
  display: none;
}

.filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 var(--s-3);
  border-radius: var(--r-full);
  border: 1px solid transparent;
  font-size: var(--fs-12);
  font-weight: 550;
  color: var(--text-3);
  white-space: nowrap;
  transition:
    background-color var(--dur-2) var(--ease-out),
    color var(--dur-2) var(--ease-out),
    border-color var(--dur-2) var(--ease-out);
}

.filter:hover {
  background: var(--neutral-soft);
  color: var(--text);
}

.filter.is-active {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--text);
}

.filter__count {
  font-size: 10px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.filter.is-active .filter__count {
  color: var(--accent);
}

.view-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  flex: none;
}

.view-toggle button {
  width: 28px;
  height: 26px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  color: var(--text-3);
  transition:
    background-color var(--dur-2) var(--ease-out),
    color var(--dur-2) var(--ease-out);
}

.view-toggle button svg {
  width: 15px;
  height: 15px;
}

.view-toggle button.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-1);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--s-4);
}

.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-4) var(--s-3);
  text-align: left;
  color: var(--text);
  background: linear-gradient(180deg, oklch(1 1 1 / 0.025), transparent 46%), var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  min-height: 186px;
  transition:
    border-color var(--dur-2) var(--ease-out),
    transform var(--dur-2) var(--ease-out),
    box-shadow var(--dur-2) var(--ease-out),
    background-color var(--dur-2) var(--ease-out);
}

:root[data-theme='light'] .product-card {
  background: var(--surface);
}

@media (hover: hover) {
  .product-card:hover {
    border-color: var(--line-strong);
    transform: translateY(-2px);
    box-shadow: var(--shadow-3);
  }
}

.product-card:active {
  transform: scale(0.995);
}

.product-card.is-down {
  border-color: oklch(0.72 0.19 22 / 0.32);
}

.product-card.is-degraded {
  border-color: oklch(0.85 0.145 82 / 0.26);
}

.product-card__head {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
}

.monogram {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: var(--fs-13);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: oklch(0.88 0.09 var(--brand, 198));
  background: oklch(0.72 0.1 var(--brand, 198) / 0.16);
  border: 1px solid oklch(0.78 0.1 var(--brand, 198) / 0.24);
  text-transform: uppercase;
  position: relative;
}

:root[data-theme='light'] .monogram {
  color: oklch(0.42 0.11 var(--brand, 198));
  background: oklch(0.62 0.12 var(--brand, 198) / 0.11);
  border-color: oklch(0.55 0.12 var(--brand, 198) / 0.2);
}

.monogram--sm {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-size: var(--fs-11);
}

.monogram__status {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--surface);
}

.product-card__ident {
  min-width: 0;
  flex: 1;
}

.product-card__name {
  font-size: var(--fs-15);
  font-size: 15px;
  font-weight: 620;
  letter-spacing: -0.015em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-card__addr {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-11);
  color: var(--text-3);
  font-family: var(--font-mono);
  min-width: 0;
  margin-top: 2px;
}

.product-card__addr a {
  color: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-card__addr svg {
  width: 12px;
  height: 12px;
  flex: none;
}

.product-card__tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.product-card__spacer {
  flex: 1;
}

.product-card__foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-3);
  padding-top: var(--s-2);
  border-top: 1px solid var(--line-soft);
}

.product-card__stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.product-card__stat span {
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.product-card__stat strong {
  font-size: var(--fs-12);
  font-weight: 620;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.product-card__bars {
  width: 86px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}

.product-card__bars .bars {
  width: 100%;
}

.product-card__bars small {
  font-size: 10px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.product-card__tls {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-11);
  font-weight: 560;
  color: var(--text-2);
  white-space: nowrap;
}

.product-card__tls svg {
  width: 12px;
  height: 12px;
}

.product-card__tls.is-warn {
  color: var(--warning);
}

.product-card__tls.is-danger {
  color: var(--danger-bright);
}

/* таблица продуктов */

.products-table .monogram {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 10px;
}

.products-table .monogram__status {
  border-color: var(--surface);
}

.table-product {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-width: 200px;
}

.table-product__text {
  min-width: 0;
}

.table-product__text strong {
  display: block;
  font-size: var(--fs-13);
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-product__text span {
  display: block;
  font-size: var(--fs-11);
  color: var(--text-3);
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stack-chips {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.chip-stack {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  font-size: 10px;
  font-weight: 560;
  color: var(--text-3);
  font-family: var(--font-mono);
}

/* ---------- мониторинг ---------- */

.monitor-list {
  display: flex;
  flex-direction: column;
}

.monitor-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) minmax(180px, 2.5fr) 92px 110px;
  gap: var(--s-4);
  align-items: center;
  padding: var(--s-3) var(--s-5);
  border-bottom: 1px solid var(--line-soft);
}

.monitor-row:last-child {
  border-bottom: none;
}

.monitor-row__name {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-width: 0;
}

.monitor-row__name strong {
  font-size: var(--fs-12);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.monitor-row__pct {
  font-size: var(--fs-13);
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.monitor-row__pct.is-bad {
  color: var(--danger-bright);
}

.monitor-row__pct.is-warn {
  color: var(--warning);
}

.monitor-row__meta {
  font-size: var(--fs-11);
  color: var(--text-3);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.monitor-bars {
  display: flex;
  gap: 2px;
  align-items: stretch;
  height: 26px;
}

.monitor-bars__item {
  flex: 1;
  border-radius: 2px;
  background: var(--line-soft);
  min-width: 2px;
  position: relative;
}

.monitor-bars__item.is-up {
  background: oklch(0.82 0.155 158 / 0.6);
}

.monitor-bars__item.is-degraded {
  background: var(--warning);
  opacity: 0.8;
}

.monitor-bars__item.is-down {
  background: var(--danger-bright);
}

.monitor-bars__item.is-none {
  background: var(--line-soft);
  opacity: 0.4;
}

.scan-log {
  display: flex;
  flex-direction: column;
}

.scan-log__row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-5);
  border-bottom: 1px solid var(--line-soft);
  font-size: var(--fs-12);
}

.scan-log__row:last-child {
  border-bottom: none;
}

.scan-log__time {
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  color: var(--text-3);
  min-width: 128px;
}

.scan-log__title {
  flex: 1;
  color: var(--text-2);
}

.scan-log__meta {
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: var(--fs-11);
}

/* ---------- сервер ---------- */

.host-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--s-4);
}

.rings--lg {
  gap: var(--s-2);
}

.rings--lg .ring__chart {
  width: 108px;
  height: 108px;
}

.rings--lg .ring__pct {
  font-size: var(--fs-18);
}

.host-traffic {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  margin-top: var(--s-4);
}

.host-traffic__row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) 44px;
  align-items: center;
  gap: var(--s-3);
  font-size: var(--fs-11);
  color: var(--text-3);
}

.host-traffic__bar {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
}

.host-traffic__bar span {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  opacity: 0.8;
}

.host-traffic__value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}

.svc-list {
  display: flex;
  flex-direction: column;
}

.svc-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-5);
  border-bottom: 1px solid var(--line-soft);
  font-size: var(--fs-12);
}

.svc-row:last-child {
  border-bottom: none;
}

.svc-row__name {
  flex: 1;
  color: var(--text-2);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.svc-row__ver {
  font-size: var(--fs-11);
  color: var(--text-3);
  font-family: var(--font-mono);
  max-width: 46%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.disk-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.disk-row__top {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  font-size: var(--fs-12);
}

.disk-row__mount {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--text);
}

.disk-row__size {
  margin-left: auto;
  font-size: var(--fs-11);
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.disk-row__bar {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
  margin-top: 6px;
}

.disk-row__bar span {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--success);
  transition: width 900ms var(--ease-out);
}

.disk-row__bar.is-warn span {
  background: var(--warning);
}

.disk-row__bar.is-danger span {
  background: var(--danger-bright);
}

.info-rows {
  display: flex;
  flex-direction: column;
}

.info-row {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: var(--fs-12);
}

.info-row:last-child {
  border-bottom: none;
}

.info-row__label {
  color: var(--text-3);
  width: 138px;
  flex: none;
}

.info-row__value {
  color: var(--text);
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-size: 11.5px;
}

/* ---------- настройки ---------- */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-4);
  align-items: start;
}

.settings-grid .card--wide {
  grid-column: 1 / -1;
}

.setting-row {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--line-soft);
}

.setting-row:last-child {
  border-bottom: none;
}

.setting-row__text {
  min-width: 0;
  flex: 1;
}

.setting-row__title {
  font-size: var(--fs-13);
  font-weight: 560;
  color: var(--text);
}

.setting-row__desc {
  font-size: var(--fs-11);
  color: var(--text-3);
  margin-top: 2px;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-2);
}

.form-note {
  font-size: var(--fs-11);
  color: var(--text-3);
}

.settings-note {
  display: flex;
  gap: var(--s-2);
  align-items: flex-start;
  padding: var(--s-3);
  border-radius: var(--r-sm);
  background: var(--accent-softer);
  border: 1px solid oklch(0.83 0.125 198 / 0.14);
  font-size: var(--fs-11);
  color: var(--text-2);
  line-height: 1.5;
}

.settings-note svg {
  width: 14px;
  height: 14px;
  flex: none;
  margin-top: 1px;
  color: var(--accent);
}

/* ---------- вход ---------- */

.login-page {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
}

.login-visual {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--s-8);
  background:
    radial-gradient(760px 540px at 20% 8%, oklch(0.83 0.125 198 / 0.14), transparent 66%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-deeper) 100%);
  border-right: 1px solid var(--line-soft);
}

.login-visual__content {
  position: relative;
  z-index: 2;
  max-width: 440px;
}

.login-visual__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: auto;
}

.login-visual h1 {
  font-size: clamp(30px, 3.4vw, 46px);
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-top: var(--s-6);
}

.login-visual h1 em {
  font-style: normal;
  color: var(--accent);
}

.login-visual__lead {
  margin-top: var(--s-4);
  font-size: var(--fs-14);
  color: var(--text-3);
  max-width: 42ch;
}

.login-visual__points {
  margin-top: var(--s-6);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.login-point {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-size: var(--fs-12);
  color: var(--text-2);
}

.login-point__icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  color: var(--accent);
  flex: none;
}

.login-point__icon svg {
  width: 15px;
  height: 15px;
}

.login-visual__foot {
  position: relative;
  z-index: 2;
  font-size: var(--fs-11);
  color: var(--text-faint);
  font-family: var(--font-mono);
}

/* орбитальная графика */
.orbit {
  position: absolute;
  right: -140px;
  bottom: -180px;
  width: 640px;
  height: 640px;
  z-index: 1;
  opacity: 0.85;
  pointer-events: none;
}

.orbit__ring {
  position: absolute;
  inset: 0;
  margin: auto;
  border-radius: 50%;
  border: 1px solid oklch(0.83 0.125 198 / 0.16);
}

.orbit__ring:nth-child(1) {
  width: 620px;
  height: 620px;
}

.orbit__ring:nth-child(2) {
  width: 470px;
  height: 470px;
  border-color: oklch(0.83 0.125 198 / 0.12);
}

.orbit__ring:nth-child(3) {
  width: 320px;
  height: 320px;
  border-color: oklch(0.83 0.125 198 / 0.1);
}

.orbit__spin {
  position: absolute;
  inset: 0;
  animation: orbit-spin 46s linear infinite;
}

.orbit__spin--reverse {
  animation-direction: reverse;
  animation-duration: 62s;
}

@keyframes orbit-spin {
  to {
    transform: rotate(360deg);
  }
}

.orbit__dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 16px oklch(0.83 0.125 198 / 0.8);
}

.orbit__dot--a {
  top: 4px;
  left: 50%;
}

.orbit__dot--b {
  bottom: 60px;
  left: 22%;
  width: 5px;
  height: 5px;
  opacity: 0.7;
}

.orbit__core {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 74px;
  height: 74px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, oklch(0.83 0.125 198 / 0.2), oklch(0.83 0.125 198 / 0.04));
  border: 1px solid oklch(0.83 0.125 198 / 0.3);
  color: var(--accent);
  box-shadow: 0 0 60px oklch(0.83 0.125 198 / 0.25);
}

.orbit__core svg {
  width: 32px;
  height: 32px;
}

.login-panel {
  display: grid;
  place-items: center;
  padding: var(--s-6);
  background: var(--bg-deep);
}

.login-card {
  width: min(400px, 100%);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.login-card__head {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.login-card__title {
  font-size: var(--fs-28);
  font-weight: 650;
  letter-spacing: -0.03em;
}

.login-card__sub {
  font-size: var(--fs-13);
  color: var(--text-3);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-5);
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
}

.password-field {
  position: relative;
}

.password-field .input {
  padding-right: 44px;
  height: 42px;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
}

.password-field__toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 30px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--text-3);
}

.password-field__toggle:hover {
  background: var(--neutral-soft);
  color: var(--text);
}

.password-field__toggle svg {
  width: 16px;
  height: 16px;
}

.login-error {
  display: flex;
  gap: var(--s-2);
  align-items: flex-start;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  background: var(--danger-soft);
  border: 1px solid oklch(0.72 0.19 22 / 0.3);
  color: var(--danger-bright);
  font-size: var(--fs-12);
}

.login-error svg {
  width: 15px;
  height: 15px;
  flex: none;
  margin-top: 1px;
}

.login-setup {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-3);
  border-radius: var(--r-sm);
  background: var(--accent-softer);
  border: 1px solid oklch(0.83 0.125 198 / 0.16);
  font-size: var(--fs-11);
  color: var(--text-2);
  line-height: 1.55;
}

.login-setup code {
  font-size: 10.5px;
  overflow-wrap: anywhere;
  color: var(--accent);
}

.login-foot {
  text-align: center;
  font-size: var(--fs-11);
  color: var(--text-faint);
  font-family: var(--font-mono);
}

/* ---------- drawer: детали продукта ---------- */

.detail-hero {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-4);
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line-soft);
}

.detail-hero__top {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.detail-hero__addr {
  min-width: 0;
  flex: 1;
}

.detail-hero__url {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-12);
  color: var(--accent);
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
}

.detail-hero__url svg {
  width: 13px;
  height: 13px;
  flex: none;
}

.detail-hero__actions {
  display: flex;
  gap: var(--s-1);
}

.detail-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-2);
}

.detail-metric {
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  min-width: 0;
}

.detail-metric span {
  display: block;
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-metric strong {
  display: block;
  font-size: var(--fs-13);
  font-weight: 620;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.detail-section {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.detail-section__head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-11);
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
}

.detail-section__head svg {
  width: 13px;
  height: 13px;
}

.detail-panel {
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.detail-note {
  width: 100%;
  min-height: 72px;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-deep);
  color: var(--text);
  font-size: var(--fs-12);
  line-height: 1.5;
  resize: vertical;
}

.detail-note:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-softer);
}

.note-state {
  font-size: 10.5px;
  color: var(--text-3);
  min-height: 14px;
}

.chart-box {
  padding: var(--s-3) var(--s-2) var(--s-2);
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line-soft);
}

.chart-box svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart-legend {
  display: flex;
  gap: var(--s-3);
  padding: 0 var(--s-2) var(--s-1);
  font-size: 10px;
  color: var(--text-3);
  flex-wrap: wrap;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chart-legend i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
}

.related-alert {
  display: flex;
  gap: var(--s-2);
  align-items: flex-start;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  background: var(--warning-soft);
  border: 1px solid oklch(0.85 0.145 82 / 0.24);
  font-size: var(--fs-11);
  color: var(--text-2);
}

.related-alert--critical {
  background: var(--danger-soft);
  border-color: oklch(0.72 0.19 22 / 0.3);
}

.related-alert svg {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--warning);
  margin-top: 1px;
}

.related-alert--critical svg {
  color: var(--danger-bright);
}

.related-alert strong {
  display: block;
  color: var(--text);
  font-weight: 620;
}

.history-list {
  display: flex;
  flex-direction: column;
}

.history-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 10px var(--s-4);
  border-bottom: 1px solid var(--line-soft);
  font-size: var(--fs-12);
}

.history-row:last-child {
  border-bottom: none;
}

.history-row__time {
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  color: var(--text-3);
  min-width: 96px;
}

.history-row__main {
  flex: 1;
  min-width: 0;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-row__ms {
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
  font-size: var(--fs-11);
}

/* ---------- адаптив ---------- */

@media (max-width: 1280px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bento .col-7,
  .bento .col-5,
  .bento .col-4 {
    grid-column: span 6;
  }

  .bento .col-8,
  .bento .col-9 {
    grid-column: span 12;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1180px) {
  .app-layout {
    grid-template-columns: var(--sidebar-rail) minmax(0, 1fr);
  }

  .sidebar {
    align-items: center;
    padding: var(--s-5) var(--s-2) var(--s-4);
  }

  .brand {
    justify-content: center;
    padding: 0 0 var(--s-2);
  }

  .brand__text,
  .nav__label,
  .nav__item span,
  .nav__badge,
  .host-chip__meta {
    display: none;
  }

  .nav {
    width: 100%;
    align-items: center;
  }

  .nav__item {
    width: 46px;
    justify-content: center;
    padding: 0;
  }

  .host-chip {
    justify-content: center;
    padding: var(--s-2);
  }

  .topbar {
    padding: 0 var(--s-4);
  }

  .search-trigger {
    min-width: 34px;
    width: 34px;
    padding: 0;
    justify-content: center;
  }

  .search-trigger span,
  .search-trigger kbd {
    display: none;
  }
}

@media (max-width: 900px) {
  .app-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 264px;
    align-items: stretch;
    padding: var(--s-5) var(--s-3);
    transform: translateX(-102%);
    transition: transform var(--dur-3) var(--ease-out);
    z-index: 80;
    box-shadow: var(--shadow-3);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar.is-open .brand {
    justify-content: flex-start;
    padding: var(--s-1) var(--s-3) var(--s-3);
  }

  .sidebar.is-open .brand__text,
  .sidebar.is-open .nav__label,
  .sidebar.is-open .nav__item span,
  .sidebar.is-open .nav__badge,
  .sidebar.is-open .host-chip__meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .sidebar.is-open .nav__label {
    display: block;
  }

  .sidebar.is-open .nav__badge {
    display: grid;
  }

  .sidebar.is-open .nav {
    align-items: stretch;
  }

  .sidebar.is-open .nav__item {
    width: auto;
    justify-content: flex-start;
    padding: 0 var(--s-3);
  }

  .sidebar.is-open .host-chip {
    justify-content: flex-start;
    padding: var(--s-3);
  }

  .menu-btn {
    display: grid;
  }

  .topbar {
    padding: 0 var(--s-4);
    gap: var(--s-2);
  }

  .page {
    padding: var(--s-5) var(--s-4) var(--s-9);
  }

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

  .bento .col-7,
  .bento .col-5,
  .bento .col-4,
  .bento .col-6 {
    grid-column: span 12;
  }

  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }

  .login-page {
    grid-template-columns: 1fr;
  }

  .login-visual {
    display: none;
  }

  .monitor-row {
    grid-template-columns: minmax(140px, 1fr) 90px 88px;
    gap: var(--s-3);
  }

  .monitor-row__bars {
    display: none;
  }

  .host-grid .col-6,
  .host-grid .col-5,
  .host-grid .col-7,
  .host-grid .col-4 {
    grid-column: span 12;
  }

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

@media (max-width: 640px) {
  .topbar__sub {
    display: none;
  }

  .topbar__title {
    font-size: var(--fs-13);
  }

  .page {
    padding: var(--s-4) var(--s-3) var(--s-8);
    gap: var(--s-4);
  }

  .page__title {
    font-size: var(--fs-22);
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .metric__value {
    font-size: var(--fs-28);
  }

  .product-grid {
    grid-template-columns: 1fr;
  }

  .drawer {
    width: 100vw;
  }

  .drawer__head,
  .drawer__body {
    padding-left: var(--s-4);
    padding-right: var(--s-4);
  }

  .rings {
    gap: var(--s-2);
  }

  .ring__chart {
    width: 74px;
    height: 74px;
  }

  .schedule__time {
    font-size: var(--fs-34);
  }

  .monitor-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .monitor-row__bars,
  .monitor-row__meta {
    display: none;
  }

  .toasts {
    left: var(--s-3);
    right: var(--s-3);
    bottom: var(--s-3);
    max-width: none;
  }

  .settings-grid {
    gap: var(--s-3);
  }

  .kv {
    grid-template-columns: 104px minmax(0, 1fr);
  }

  .page__actions {
    width: 100%;
  }

  .products-toolbar {
    gap: var(--s-2);
  }

  .search-field {
    max-width: none;
    order: 3;
    width: 100%;
  }

  .scan-btn span {
    display: none;
  }

  .scan-btn {
    padding: 0 10px;
  }
}

@media (max-width: 380px) {
  .topbar__actions .search-trigger {
    display: none;
  }

  .ring__chart {
    width: 64px;
    height: 64px;
  }
}

/* ---------- боты ---------- */

.kpi-grid--5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.bots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: var(--s-4);
}

.bot-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-4);
}

.bot-card__head {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
}

.bot-card__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
}

.bot-card__icon--docker {
  background: oklch(0.7 0.11 240 / 0.14);
  color: oklch(0.78 0.11 240);
}

.bot-card__icon--pm2 {
  background: oklch(0.78 0.14 150 / 0.13);
  color: var(--success);
}

.bot-card__icon--project,
.bot-card__icon--process {
  background: oklch(0.8 0.1 85 / 0.12);
  color: var(--warning);
}

.bot-card__title {
  min-width: 0;
  flex: 1;
}

.bot-card__name {
  margin: 0;
  font-size: var(--fs-14);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bot-card__kind {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bot-card__desc {
  margin: 0;
  min-height: 2.6em;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-2);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.bot-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px var(--s-3);
  font-size: 11px;
  color: var(--text-3);
}

.bot-card__meta-item {
  white-space: nowrap;
}

.bot-card__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  margin-top: auto;
  padding-top: var(--s-2);
  border-top: 1px solid var(--line-soft);
}

.bot-card__actions .btn {
  min-height: 34px;
}

.bot-card__notice {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 8px 10px;
  border-radius: var(--r-2);
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 11.5px;
  line-height: 1.45;
}

.bot-autostart {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
}

.bot-autostart.is-static {
  font-size: 11px;
}

.nav__badge--danger {
  background: var(--danger-soft);
  color: var(--danger-bright);
}

.toolbar-spacer {
  flex: 1;
}

/* логи бота */
.logs-note {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  margin-bottom: var(--s-3);
  border-radius: var(--r-2);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
}

.logs-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--s-5);
  color: var(--text-3);
  font-size: 13px;
}

.log-view {
  margin: 0;
  padding: var(--s-3);
  border-radius: var(--r-2);
  background: oklch(0.14 0.012 250);
  color: oklch(0.88 0.02 180);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
  max-height: 58vh;
}

[data-theme='light'] .log-view {
  background: oklch(0.2 0.02 250);
  color: oklch(0.9 0.02 180);
}

/* инструкция */
.bots-guide {
  margin-top: var(--s-5);
}

.bots-guide__body {
  display: grid;
  gap: var(--s-4);
}

.bots-guide__steps {
  margin: 0;
  padding-left: 1.2em;
  display: grid;
  gap: 8px;
  font-size: var(--fs-13);
  line-height: 1.55;
  color: var(--text-2);
}

.bots-guide__steps code,
.bots-guide__note code {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text);
}

.bots-guide__code {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-2);
  overflow: hidden;
}

.code-block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 6px 8px 6px 12px;
  background: var(--surface-2);
  font-size: 11.5px;
  color: var(--text-2);
}

.code-block {
  margin: 0;
  padding: var(--s-3);
  overflow: auto;
  max-height: 320px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.65;
  color: var(--text-2);
  white-space: pre;
  background: var(--surface);
}

.bots-guide__note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-3);
}

/* ---------- журнал событий (мониторинг) ---------- */

.event-log {
  display: flex;
  flex-direction: column;
}

.event-log__row {
  display: grid;
  grid-template-columns: 108px 8px minmax(0, 1fr) minmax(0, 1.1fr);
  gap: var(--s-3);
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: var(--fs-12);
  min-height: 40px;
}

.event-log__row:last-child {
  border-bottom: none;
}

.event-log__time {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-3);
  white-space: nowrap;
}

.event-log__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
}

.event-log__dot.is-danger {
  background: var(--danger-bright);
}

.event-log__dot.is-warning {
  background: var(--warning);
}

.event-log__dot.is-success {
  background: var(--success);
}

.event-log__dot.is-info {
  background: var(--info);
}

.event-log__title {
  color: var(--text);
  font-weight: 520;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-log__detail {
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 10.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* уровни в журнале сканера */
.dot-info {
  color: var(--text-2);
}

.dot-warn,
.dot-warning {
  color: var(--warning);
}

.dot-error {
  color: var(--danger-bright);
}

.dot-success {
  color: var(--success);
}

@media (max-width: 700px) {
  .event-log__row {
    grid-template-columns: 78px 8px minmax(0, 1fr);
  }

  .event-log__detail {
    display: none;
  }
}

/* печать: без декора, читаемые данные */
@media print {
  .sidebar,
  .topbar__actions,
  .toasts,
  .scrim,
  .drawer {
    display: none !important;
  }

  .app-layout {
    display: block;
  }

  body::before,
  body::after {
    display: none;
  }

  .card {
    break-inside: avoid;
    box-shadow: none;
  }
}

@media (max-width: 1180px) {
  .kpi-grid--5 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .kpi-grid--5 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .bots-grid {
    grid-template-columns: 1fr;
  }

  .bot-card__actions .btn {
    flex: 1;
  }
}