/* Панель управления мониторингом. Токены и компоненты — по KOVION Design System:
   монохром и один сигнальный акцент, радиус 2, без теней, контролы 40 / 32 px. */

@font-face {
  font-family: 'Onest';
  font-weight: 400;
  font-display: swap;
  src: url('fonts/onest-cyrillic-400-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Onest';
  font-weight: 400;
  font-display: swap;
  src: url('fonts/onest-latin-400-normal.woff2') format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074,
    U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Onest';
  font-weight: 500;
  font-display: swap;
  src: url('fonts/onest-cyrillic-500-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Onest';
  font-weight: 500;
  font-display: swap;
  src: url('fonts/onest-latin-500-normal.woff2') format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074,
    U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Onest';
  font-weight: 600;
  font-display: swap;
  src: url('fonts/onest-cyrillic-600-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Onest';
  font-weight: 600;
  font-display: swap;
  src: url('fonts/onest-latin-600-normal.woff2') format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074,
    U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Onest';
  font-weight: 700;
  font-display: swap;
  src: url('fonts/onest-cyrillic-700-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Onest';
  font-weight: 700;
  font-display: swap;
  src: url('fonts/onest-latin-700-normal.woff2') format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074,
    U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-weight: 400;
  font-display: swap;
  src: url('fonts/jetbrains-mono-cyrillic-400-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-weight: 400;
  font-display: swap;
  src: url('fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074,
    U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-weight: 500;
  font-display: swap;
  src: url('fonts/jetbrains-mono-cyrillic-500-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-weight: 500;
  font-display: swap;
  src: url('fonts/jetbrains-mono-latin-500-normal.woff2') format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074,
    U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ink: #111113;
  --ink-2: #46484e;
  --ink-3: #6b6d73;
  --line-2: #b9bbc0;
  --line: #dddee1;
  --ground: #f3f3f2;
  --paper: #ffffff;
  --raise: #fafaf9;
  --hover: #2a2b2f;
  --disabled: #8c8e93;
  --signal: #f0561d;
  --signal-soft: #fde9e0;
  --signal-tint: #fff6f2;
  --signal-text: #a8350b;
  --ok: #1f7a4a;
  --ok-soft: #e2f1e8;
  --ok-text: #17603a;
  --info: #2d4fd0;
  --info-soft: #e5eafb;
  --info-text: #1e3aa8;
  --scrim: rgba(17, 17, 19, 0.48);
  --focus: 0 0 0 3px rgba(240, 86, 29, 0.35);
  --font: 'Onest', 'Segoe UI', system-ui, sans-serif;
  --mono: 'JetBrains Mono', Consolas, monospace;
  --radius: 2px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
}
body {
  font: 400 15px/1.5 var(--font);
  color: var(--ink);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
}
h1,
h2,
h3,
h4,
p {
  margin: 0;
}
a {
  color: var(--ink);
  text-decoration-color: var(--line-2);
  text-underline-offset: 3px;
}
a:hover {
  color: var(--signal-text);
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}
[hidden] {
  display: none !important;
}
.mono {
  font-family: var(--mono);
  font-size: 0.92em;
}
.muted {
  color: var(--ink-3);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---- оболочка ---- */
.shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}
.nav {
  background: var(--paper);
  border-right: 1px solid var(--line);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 12px 20px;
}
.brand-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}
.brand.large .brand-name {
  font-size: 16px;
}
.mark-frame {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--ink);
  color: var(--ink);
  background: var(--paper);
  flex: none;
}
.mark-frame svg {
  display: block;
}
.nav a.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink-2);
}
.nav a.item:hover {
  background: var(--raise);
  color: var(--ink);
}
.nav a.item[aria-current='page'] {
  background: var(--ground);
  color: var(--ink);
  font-weight: 600;
}
.nav .count {
  font: 500 12px var(--mono);
  color: var(--ink-3);
}
.nav .count.alert {
  color: var(--signal-text);
}
.nav-spacer {
  flex: 1;
}
.nav-foot {
  border-top: 1px solid var(--line);
  padding: 12px 12px 0;
  font-size: 13px;
  color: var(--ink-3);
  display: grid;
  gap: 8px;
}
.nav-foot strong {
  color: var(--ink);
  font-weight: 600;
}
.main {
  padding: 28px 40px 64px;
  min-width: 0;
  max-width: 1360px;
  width: 100%;
}
@media (max-width: 880px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .nav {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 12px;
  }
  .brand {
    width: 100%;
    padding-bottom: 8px;
  }
  .nav-spacer,
  .nav-foot {
    display: none;
  }
  .main {
    padding: 20px 16px 48px;
  }
}

/* ---- шапка экрана ---- */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: 24px;
}
.crumbs {
  font-size: 13px;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.crumbs a {
  color: var(--ink-3);
}
.page-head h1 {
  font-size: 28px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.page-head .sub {
  color: var(--ink-2);
  margin-top: 6px;
  max-width: 70ch;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* ---- кнопки ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover {
  background: var(--hover);
  color: var(--paper);
}
.btn.secondary {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--line-2);
}
.btn.secondary:hover {
  background: var(--raise);
  border-color: var(--ink);
  color: var(--ink);
}
.btn.text {
  background: transparent;
  border-color: transparent;
  color: var(--ink);
  padding: 0 8px;
  text-decoration: underline;
  text-decoration-color: var(--line-2);
  text-underline-offset: 3px;
}
.btn.text:hover {
  background: transparent;
  color: var(--signal-text);
}
.btn.small {
  min-height: 32px;
  padding: 0 12px;
  font-size: 14px;
}
.btn[disabled] {
  background: var(--ground);
  border-color: var(--line);
  color: var(--disabled);
  cursor: not-allowed;
}
.btn.danger-confirm {
  background: var(--ink);
  color: var(--paper);
}

/* ---- поля ---- */
.field {
  display: grid;
  gap: 6px;
  align-content: start;
}
.field > label,
.label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.input,
.select,
.textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
}
.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--ink-3);
}
.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--ink);
  box-shadow: var(--focus);
  outline: none;
}
.input[aria-invalid='true'],
.select[aria-invalid='true'],
.textarea[aria-invalid='true'] {
  border-color: var(--signal);
}
.input[disabled],
.select[disabled],
.textarea[disabled] {
  background: var(--ground);
  color: var(--disabled);
}
.input.mono,
.textarea.mono {
  font-family: var(--mono);
}
.textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.45;
}
.hint {
  font-size: 13px;
  color: var(--ink-3);
}
.error-text {
  font-size: 13px;
  color: var(--signal-text);
}
.form-grid {
  display: grid;
  gap: 16px 20px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.form-grid .wide {
  grid-column: 1 / -1;
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
}
.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--ink);
  margin: 0;
}
.chips-input {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  min-height: 40px;
}
.chips-input:focus-within {
  border-color: var(--ink);
  box-shadow: var(--focus);
}
.chips-input input {
  border: 0;
  outline: none;
  flex: 1;
  min-width: 120px;
  padding: 4px 6px;
  background: transparent;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 0 8px;
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
}
.tag button {
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--ink-3);
  padding: 0;
  font-size: 16px;
  line-height: 1;
}
.tag button:hover {
  color: var(--signal-text);
}
.segmented {
  display: inline-flex;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper);
}
.segmented button {
  min-height: 32px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-right: 1px solid var(--line);
}
.segmented button:last-child {
  border-right: 0;
}
.segmented button[aria-pressed='true'] {
  background: var(--ink);
  color: var(--paper);
}

/* ---- карточки, сетка ---- */
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.panel > .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}
.panel > .panel-head h2 {
  font-size: 16px;
  font-weight: 600;
}
.panel > .panel-body {
  padding: 20px;
}
.stack {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr);
}
.stack > * {
  min-width: 0;
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.cols-2 {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
}
@media (max-width: 520px) {
  .cols-2 {
    grid-template-columns: 1fr;
  }
}
.tiles {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.tile {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: grid;
  gap: 4px;
}
.tile .num {
  font: 600 32px/1.1 var(--font);
  letter-spacing: -0.02em;
}
.tile .cap {
  font-size: 13px;
  color: var(--ink-3);
}
.tile.alert {
  border-color: var(--signal);
  background: var(--signal-tint);
}
.tile.alert .num {
  color: var(--signal-text);
}
.banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--ink);
  background: var(--paper);
  border-radius: var(--radius);
}
.banner.problem {
  border-color: var(--signal);
  background: var(--signal-tint);
}
.banner.problem::before {
  content: '!';
  flex: none;
  width: 20px;
  height: 20px;
  background: var(--signal);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
}
.banner.ok {
  border-color: var(--ok);
  background: var(--ok-soft);
  color: var(--ok-text);
}

/* ---- начало работы (свежая установка) ---- */
.setup {
  border: 1px solid var(--ink);
  background: var(--paper);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: grid;
  gap: 10px;
}
.setup h2 {
  font-size: 17px;
  font-weight: 600;
}
.setup ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}
.setup li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line-2);
}
.setup li > div {
  display: grid;
  gap: 2px;
}
.setup li.done strong {
  color: var(--ink-2);
  text-decoration: line-through;
}

/* ---- чипы состояний ---- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 26px;
  padding: 0 10px 0 8px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  background: var(--paper);
  white-space: nowrap;
}
.chip::before {
  content: '';
  width: 9px;
  height: 9px;
  border: 1.5px solid var(--ink-2);
  background: transparent;
  flex: none;
}
.chip.done {
  background: var(--ok-soft);
  border-color: var(--ok-soft);
  color: var(--ok-text);
}
.chip.done::before {
  background: var(--ok);
  border-color: var(--ok);
}
.chip.progress {
  background: var(--info-soft);
  border-color: var(--info-soft);
  color: var(--info-text);
}
.chip.progress::before {
  border-color: var(--info);
  background: var(--info);
}
.chip.attention {
  border-color: var(--signal);
  color: var(--signal-text);
  background: var(--paper);
}
.chip.attention::before {
  border-color: var(--signal);
}
.chip.problem {
  background: var(--signal-soft);
  border-color: var(--signal-soft);
  color: var(--signal-text);
}
.chip.problem::before {
  background: var(--signal);
  border-color: var(--signal);
}
.chip.draft {
  border-style: dashed;
  color: var(--ink-2);
}
.chip.cancelled {
  color: var(--ink-3);
  border-color: var(--line);
}
.chip.cancelled::before {
  border-color: var(--ink-3);
}
.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  background: var(--line-2);
  margin-right: 6px;
}
.dot.up {
  background: var(--ok);
}
.dot.suspect {
  background: var(--signal);
  opacity: 0.55;
}
.dot.down,
.dot.lost {
  background: var(--signal);
}
.dot.nodata {
  background: var(--line-2);
}
.badge {
  display: inline-block;
  min-width: 20px;
  padding: 0 6px;
  text-align: center;
  font: 500 12px/20px var(--mono);
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* ---- таблица-сетка ---- */
.table {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
  overflow-y: hidden;
}
.t-row {
  display: grid;
  grid-template-columns: var(--cols);
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  min-height: 52px;
  border-bottom: 1px solid var(--line);
  min-width: var(--min, 0);
}
.t-row:last-child {
  border-bottom: 0;
}
.panel-body > .table:only-child {
  margin: -20px;
  border: 0;
  border-radius: 0;
  width: calc(100% + 40px);
}
.t-head {
  min-height: 38px;
  background: var(--raise);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.t-row.clickable {
  cursor: pointer;
}
.t-row.clickable:hover {
  background: var(--raise);
}
.t-row.problem {
  background: var(--signal-tint);
}
.t-cell {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.t-cell.num {
  text-align: right;
  font-family: var(--mono);
}
.t-cell .sub {
  display: block;
  font-size: 13px;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.t-cell strong {
  font-weight: 600;
}
.t-group {
  background: var(--ground);
  padding: 8px 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line);
  min-width: var(--min, 0);
}

/* ---- фильтры, вкладки ---- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.filter-bar .input,
.filter-bar .select {
  width: auto;
  min-width: 180px;
  min-height: 36px;
}
.filter-bar .count {
  margin-left: auto;
  color: var(--ink-3);
  font-size: 13px;
}
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
  overflow-x: auto;
  overflow-y: hidden; /* otherwise the active tab's underline makes a vertical scrollbar */
  scrollbar-width: thin;
}
.tabs button {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--ink-2);
  border-bottom: 0;
  box-shadow: inset 0 -2px 0 transparent;
  white-space: nowrap;
}
.tabs button[aria-selected='true'] {
  color: var(--ink);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--ink);
}
.tabs button:hover {
  color: var(--ink);
}
.tabs .badge {
  margin-left: 6px;
}

/* ---- пустое состояние, ключ-значение, код ---- */
.empty {
  padding: 48px 24px;
  text-align: center;
  display: grid;
  gap: 8px;
  justify-items: center;
}
.empty h3 {
  font-size: 17px;
  font-weight: 600;
}
.empty p {
  color: var(--ink-2);
  max-width: 52ch;
}
.empty .row {
  justify-content: center;
  margin-top: 8px;
}
.kv {
  display: grid;
  grid-template-columns: minmax(120px, 200px) 1fr;
  gap: 10px 20px;
  margin: 0;
}
.kv dt {
  color: var(--ink-3);
  font-size: 13px;
  padding-top: 2px;
}
.kv dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}
.code {
  position: relative;
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.code pre {
  overflow-y: hidden;
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font: 400 13px/1.55 var(--mono);
}
.code .code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px 6px 14px;
  border-bottom: 1px solid var(--line);
  font: 500 12px var(--mono);
  color: var(--ink-2);
}
.code.secret .code-head {
  background: var(--signal-tint);
  color: var(--signal-text);
}
.token-box {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.token-box .input {
  font-family: var(--mono);
  background: var(--signal-tint);
  border-color: var(--signal);
}
.steps {
  counter-reset: step;
  display: grid;
  gap: 16px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  align-items: start;
}
.steps li::before {
  content: counter(step);
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--paper);
  font: 500 13px var(--mono);
}
.steps h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}
.steps p {
  color: var(--ink-2);
}
.steps .code {
  margin-top: 8px;
}
.progress {
  height: 6px;
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  background: var(--ok);
}

/* ---- диалог, панель, тост ---- */
.scrim {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow-y: auto;
}
.scrim.side {
  place-items: stretch end;
  padding: 0;
}
.dialog {
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 0;
  width: min(560px, 100%);
  display: grid;
  gap: 0;
  max-height: calc(100vh - 32px);
  grid-template-rows: auto 1fr auto;
}
.dialog.wide {
  width: min(820px, 100%);
}
.drawer {
  background: var(--paper);
  border-left: 1px solid var(--ink);
  width: min(560px, 100%);
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}
.dialog > header,
.drawer > header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.dialog > header h2,
.drawer > header h2 {
  font-size: 18px;
  font-weight: 600;
}
.dialog > .body,
.drawer > .body {
  padding: 20px 24px;
  overflow-y: auto;
  display: grid;
  gap: 16px;
  align-content: start;
}
.dialog > footer,
.drawer > footer {
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.toasts {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 60;
  display: grid;
  gap: 8px;
  width: min(380px, calc(100vw - 32px));
}
.toast {
  background: var(--ink);
  color: var(--paper);
  padding: 12px 16px;
  border-radius: var(--radius);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}
.toast.error {
  background: var(--signal-text);
}
.toast button {
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  opacity: 0.8;
}

/* ---- графики ---- */
.chart {
  width: 100%;
  height: auto;
  display: block;
}
.chart text {
  font: 400 11px var(--mono);
  fill: var(--ink-3);
}
.chart .grid {
  stroke: var(--line);
  stroke-width: 1;
}
.chart .bar-ok {
  fill: var(--ok);
}
.chart .bar-fail {
  fill: var(--signal);
}
.chart .bar-none {
  fill: var(--line);
}
.chart .line {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.5;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: var(--ink-2);
}
.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
}

/* ---- вход ---- */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}
.login .panel {
  width: min(440px, 100%);
  padding: 32px;
  display: grid;
  gap: 20px;
  border-color: var(--ink);
}
.login h1 {
  font-size: 22px;
}
.login .or {
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
}

.events {
  display: grid;
}
.event {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.event:last-child {
  border-bottom: 0;
}
.event time {
  font: 400 12px var(--mono);
  color: var(--ink-3);
  padding-top: 3px;
}
.event .title {
  font-weight: 600;
}
.event .title.good {
  color: var(--ok-text);
}
.event .title.critical {
  color: var(--signal-text);
}
.event .sum {
  color: var(--ink-2);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.nowrap {
  white-space: nowrap;
}
.right {
  text-align: right;
}
.spacer {
  flex: 1;
}
.legend .bar-ok {
  background: var(--ok);
}
.legend .bar-fail {
  background: var(--signal);
}
.legend .bar-none {
  background: var(--line);
}

/* ---- аналитика и дашборд ---- */
.chart-wrap {
  position: relative;
}
.chart.interactive .capture {
  cursor: crosshair;
  touch-action: none;
}
.chart .band {
  fill: var(--info-soft);
}
.chart .cross {
  stroke: var(--ink-3);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  pointer-events: none;
}
.chart .selection {
  fill: rgba(240, 86, 29, 0.14);
  stroke: var(--signal);
  stroke-width: 1;
  pointer-events: none;
}
.chart-tip {
  position: absolute;
  z-index: 5;
  width: 250px;
  background: var(--ink);
  color: var(--paper);
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.45;
  border-radius: var(--radius);
  pointer-events: none;
}
.legend .band {
  background: var(--info-soft);
  border: 1px solid var(--info);
}
.heat {
  display: grid;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
}
.heat-row {
  display: grid;
  grid-template-columns: minmax(240px, 28%) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 2px 0;
}
.heat-name {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  text-decoration: none;
  font-size: 14px;
  min-width: 0;
}
.heat-name span:first-child {
  /* long names wrap to two lines; the full name is in the tooltip */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.heat-pct {
  font: 500 12px var(--mono);
  color: var(--ink-3);
  flex: none;
}
.heat-pct.bad {
  color: var(--signal-text);
}
.heat-cells {
  display: flex;
  gap: 3px;
  flex-wrap: nowrap;
}
.hc {
  flex: 1 1 0;
  min-width: 6px;
  max-width: 18px;
  height: 18px;
  border-radius: 2px;
  background: var(--line);
  display: inline-block;
}
.hc:hover {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}
.hc.ok {
  background: var(--ok);
}
.hc.l1 {
  background: var(--signal-soft);
}
.hc.l2 {
  background: rgba(240, 86, 29, 0.55);
}
.hc.l3 {
  background: var(--signal);
}
.hc.l4 {
  background: var(--signal-text);
}
.hc.none {
  background: var(--line);
}
.legend .hc {
  width: 14px;
  height: 14px;
  flex: none;
  margin: 0 2px;
}
@media (max-width: 720px) {
  .heat-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
.ms {
  display: grid;
  gap: 8px;
}
.ms .row .input {
  flex: 1;
  min-width: 160px;
}
.ms-list {
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  max-height: 220px;
  overflow-y: auto;
  padding: 8px 12px;
  display: grid;
  gap: 2px;
  background: var(--paper);
}
.ms-list .sub {
  display: block;
  font-size: 12px;
  color: var(--ink-3);
}
.scope-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--raise);
  display: grid;
  gap: 14px;
}
.timeline {
  display: grid;
  gap: 6px;
}
.tl-row {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  font-size: 14px;
}
.tl-track {
  position: relative;
  height: 22px;
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: 2px;
}
.tl-bar {
  position: absolute;
  top: 2px;
  bottom: 2px;
  background: var(--info);
  border-radius: 2px;
  min-width: 4px;
}
.tl-bar.now {
  background: var(--signal);
}
.tl-bar.done {
  background: var(--line-2);
}
.tl-axis {
  display: flex;
  justify-content: space-between;
  font: 400 11px var(--mono);
  color: var(--ink-3);
  padding-left: 212px;
}

/* ---- группы целей (раскрывающиеся) ---- */
.group-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.group-toolbar .select {
  width: auto;
  min-width: 190px;
  min-height: 36px;
}
.group-toolbar.flat .btn.text {
  display: none;
}
.gh {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 0 20px;
  background: var(--ground);
  border: 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--ink);
  min-width: var(--min, 0);
}
.gh:hover {
  background: #ececea;
}
.gh-chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--ink-2);
  border-bottom: 2px solid var(--ink-2);
  transform: rotate(45deg);
  margin: 0 4px 3px 2px;
  transition: transform 0.12s;
  flex: none;
}
.gh[aria-expanded='false'] .gh-chevron {
  transform: rotate(-45deg);
  margin-bottom: 0;
}
.gh-title {
  font-weight: 600;
}
.gh-chips {
  display: flex;
  gap: 8px;
  flex: 1;
  flex-wrap: wrap;
}
.gh-chip {
  font-size: 12px;
  padding: 1px 8px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: var(--paper);
}
.gh-chip.problem {
  background: var(--signal-soft);
  border-color: var(--signal-soft);
  color: var(--signal-text);
}
.gh-chip.attention {
  border-color: var(--signal);
  color: var(--signal-text);
}
.gh-chip.done {
  background: var(--ok-soft);
  border-color: var(--ok-soft);
  color: var(--ok-text);
}
.gh-chip.draft {
  border-style: dashed;
  color: var(--ink-2);
}
.gh-avail {
  font: 500 12px var(--mono);
  color: var(--ink-3);
  flex: none;
}
.table > [hidden],
.heat > [hidden] {
  display: none !important;
}
.heat .gh {
  border: 1px solid var(--line);
}

.ms-group {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0 2px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
}
.ms-group:first-child {
  border-top: 0;
  margin-top: 0;
}
.ms-fold {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  background: none;
  border: 0;
  cursor: pointer;
  font: 600 13px var(--font);
  color: var(--ink);
  text-align: left;
  padding: 4px 0;
}
.ms-fold[aria-expanded='false'] .gh-chevron {
  transform: rotate(-45deg);
  margin-bottom: 0;
}
.ms-list [hidden] {
  display: none !important;
}

/* ---- поле с чипами и выпадающим списком ---- */
.combo {
  position: relative;
  display: grid;
  gap: 4px;
}
.combo-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.combo-row .chips-input {
  flex: 1;
}
.chips-input .chips {
  display: contents;
}
.combo-list {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 60;
  max-height: 260px;
  overflow-y: auto;
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
}
.combo-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.combo-item:last-child {
  border-bottom: 0;
}
.combo-item:hover,
.combo-item[aria-selected='true'] {
  background: var(--ground);
}
.combo-item.create {
  color: var(--ink-2);
  font-style: italic;
}
.combo-item .hint {
  color: var(--ink-3);
}
.combo-empty {
  padding: 10px 12px;
  color: var(--ink-3);
}

/* ---- окно выбора целей ---- */
.picker-list {
  display: grid;
  gap: 2px;
  max-height: 46vh;
  overflow-y: auto;
  border: 1px solid var(--line-2);
  padding: 4px;
}
.picker-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 8px;
  background: var(--ground);
}
.picker-head .gh {
  flex: 1;
}
.picker-row {
  padding: 6px 8px 6px 28px;
  align-items: flex-start;
}
.picker-row.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.picker-name {
  display: grid;
  gap: 2px;
}

/* ---- перетаскивание целей между категориями ---- */
[draggable='true'] {
  cursor: grab;
}
[draggable='true'].dragging {
  opacity: 0.45;
  cursor: grabbing;
}
body.dnd .gh {
  outline: 1px dashed var(--ink-3);
  outline-offset: -3px;
}
.gh.drop-over {
  outline: 2px solid var(--ink);
  outline-offset: -2px;
  background: var(--ok-soft);
}
