:root {
  color-scheme: light;
  --bg: #f4f6fa;
  --surface: #fff;
  --ink: #17243b;
  --muted: #64748b;
  --line: #e4eaf2;
  --blue: #315fe8;
  --green: #15734e;
  --red: #bd3547;
  --amber: #96620c;
  --radius: 14px;
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 14px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
}
a {
  color: var(--blue);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea,
summary {
  outline-offset: 4px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid #93b2ff;
}
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1440px;
  margin: auto;
  padding: 0 32px;
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 48px;
}
.brand {
  font-size: 20px;
  font-weight: 760;
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--ink);
}
.brand:hover {
  text-decoration: none;
}
.brand-icon {
  display: grid;
  place-items: center;
  background: var(--blue);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  font-size: 18px;
}
.topbar nav {
  display: flex;
  gap: 8px;
}
.topbar nav a {
  padding: 10px 17px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 600;
}
.topbar nav .current {
  background: #edf2ff;
  color: var(--blue);
}
.logout {
  margin-left: auto;
}
.menu-toggle {
  display: none;
}
.main-container {
  max-width: 1440px;
  margin: auto;
  padding: 24px 32px 48px;
}
.live-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 28px;
}
.live-strip > .muted {
  margin-left: auto;
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #20a573;
}
.live-strip.stale .live-dot {
  background: var(--amber);
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin: 20px 0 28px;
}
h1 {
  font-size: 30px;
  letter-spacing: -0.035em;
  line-height: 1.2;
  margin: 0 0 10px;
}
h2 {
  font-size: 17px;
  margin: 0;
  font-weight: 700;
}
h3 {
  font-size: 14px;
  margin: 0 0 12px;
}
p {
  margin: 8px 0 16px;
}
.muted,
.caption {
  color: var(--muted);
}
.caption {
  font-size: 12px;
  line-height: 1.7;
  margin-top: 16px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 9px 15px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover {
  background: #f5f7fc;
  text-decoration: none;
}
.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}
.btn-primary:hover {
  background: #244dcb;
}
.btn-quiet {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.btn-small {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
}
.btn-danger {
  color: var(--red);
  border-color: #f1cdd3;
  background: #fff8f9;
}
.btn:disabled {
  opacity: 0.6;
  cursor: wait;
}
.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}
.summary-card {
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
}
.summary-card:hover {
  text-decoration: none;
  border-color: #b8c9ec;
}
.summary-card strong {
  font-size: 30px;
  line-height: 1.2;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.summary-card.green strong {
  color: var(--green);
}
.summary-card.red strong {
  color: var(--red);
}
.summary-card.amber strong {
  color: var(--amber);
}
.system-strip {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  padding: 16px 4px 24px;
  color: var(--muted);
  font-size: 12px;
}
.system-strip a {
  color: var(--muted);
}
.system-strip strong {
  font-weight: 600;
  color: var(--ink);
}
.system-strip .heartbeat-late {
  color: var(--red);
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 24px;
  overflow: hidden;
}
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}
.panel-heading p {
  margin: 4px 0 0;
  font-size: 12px;
}
.panel-heading a {
  font-size: 12px;
}
.filters {
  display: flex;
  align-items: end;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}
label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 600;
  font-size: 12px;
}
.filters label:first-child {
  flex: 1;
}
.filters label:nth-child(2) {
  min-width: 210px;
}
input,
select,
textarea {
  border: 1px solid #d6deeb;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  border-radius: 8px;
  width: 100%;
  min-height: 42px;
  font-weight: 400;
}
textarea {
  resize: vertical;
}
input::placeholder,
textarea::placeholder {
  color: #8a98ad;
}
.table-scroll {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
th {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.06em;
  font-weight: 650;
  text-transform: uppercase;
  padding: 13px 22px;
  background: #fafbfd;
  white-space: nowrap;
}
td {
  padding: 17px 22px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  vertical-align: middle;
}
tbody tr:hover {
  background: #fbfcff;
}
.site-name {
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 10px;
}
.site-url {
  color: var(--muted);
  font-size: 11px;
  margin-top: 4px;
  overflow-wrap: anywhere;
  max-width: 330px;
}
.favicon,
.site-avatar {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  object-fit: contain;
  flex-shrink: 0;
}
.site-avatar {
  background: #edf2ff;
  display: grid;
  place-items: center;
  color: var(--blue);
  font-size: 11px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
  background: #edf0f5;
  color: #64748b;
}
.badge:before {
  content: "";
  width: 5px;
  height: 5px;
  background: currentColor;
  border-radius: 50%;
}
.badge.online {
  background: #e8f6ef;
  color: var(--green);
}
.badge.offline {
  background: #fdecef;
  color: var(--red);
}
.badge.unknown {
  background: #fff4dc;
  color: var(--amber);
}
.reason {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  max-width: 240px;
  overflow-wrap: anywhere;
}
.numeric,
time {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.row-actions form {
  margin: 0;
}
.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  font-size: 12px;
  gap: 16px;
}
.table-footer nav > div,
.table-footer nav {
  display: flex;
  gap: 16px;
}
.table-footer nav span {
  color: var(--muted);
}
.empty {
  text-align: center;
  padding: 40px 24px;
  color: var(--muted);
}
.success-empty {
  padding: 45px 24px;
}
.success-empty h3 {
  font-size: 18px;
  color: var(--ink);
  margin: 10px 0;
}
.success-empty p {
  margin: 0;
  font-size: 12px;
}
.success-symbol {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  background: #e8f6ef;
  color: var(--green);
  border-radius: 50%;
  font-size: 23px;
}
.back-link {
  font-size: 12px;
  color: var(--muted);
}
.form-panel {
  padding: 28px;
  max-width: 960px;
}
.form-panel > label,
.form-panel > .form-grid {
  margin-bottom: 22px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
.form-grid.three {
  grid-template-columns: repeat(3, 1fr);
}
.form-actions {
  display: flex;
  justify-content: end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.checkbox {
  display: flex;
  flex-direction: row;
  align-items: center;
  font-weight: 400;
  font-size: 13px;
  gap: 10px;
}
.checkbox input {
  width: 17px;
  height: 17px;
  min-height: 0;
  accent-color: var(--blue);
}
.info-note {
  background: #f1f5ff;
  color: #40567f;
  border: 1px solid #dfe7fb;
  padding: 14px 18px;
  border-radius: 8px;
  font-size: 12px;
  margin-bottom: 22px;
}
.danger-zone {
  padding: 24px;
  max-width: 960px;
}
.danger-zone h2 {
  color: var(--red);
}
.danger-zone p {
  color: var(--muted);
  font-size: 12px;
}
.two-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.recipient {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 20px 24px;
  border-top: 1px solid var(--line);
}
.recipient p {
  font-size: 12px;
  margin: 4px 0 0;
}
.alert {
  padding: 14px 18px;
  border-radius: 9px;
  margin-bottom: 20px;
  font-size: 13px;
}
.alert.success {
  background: #e8f6ef;
  color: var(--green);
}
.alert.error {
  background: #fdecef;
  color: var(--red);
}
.alert ul {
  margin: 0;
  padding-left: 18px;
}
.error-details {
  max-width: 420px;
  overflow-wrap: anywhere;
  font-size: 11px;
  color: var(--muted);
}
.segmented {
  display: inline-flex;
  background: #eff2f7;
  padding: 3px;
  border-radius: 8px;
  gap: 3px;
}
.period-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}
.period-btn.active {
  background: white;
  color: var(--ink);
  box-shadow: 0 1px 3px #17243b1a;
}
.chart-summary {
  padding: 18px 24px 0;
  font-size: 13px;
  color: var(--muted);
}
.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  padding: 24px;
}
.chart {
  height: 190px;
  display: flex;
  align-items: end;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  padding: 14px 0 30px;
}
.bar-wrap {
  flex: 1;
  height: 100%;
  position: relative;
  display: flex;
  align-items: end;
  min-width: 0;
}
.bar {
  width: 100%;
  border-radius: 3px 3px 0 0;
  background: #7698f4;
  min-height: 3px;
  position: relative;
  cursor: help;
}
.bar.good {
  background: #48a980;
}
.bar.bad {
  background: #e78491;
}
.bar.no-data {
  background: #dce2eb;
  height: 7% !important;
}
.bar.partial {
  background-image: repeating-linear-gradient(
    135deg,
    transparent 0,
    transparent 3px,
    #ffffff80 3px,
    #ffffff80 5px
  );
}
.bar-label {
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
}
.chart-panel > .caption {
  margin: 0;
  padding: 0 24px 16px;
}
.chart-data {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
}
summary {
  cursor: pointer;
  font-weight: 600;
}
.chart-data table {
  margin-top: 15px;
}
.chart-data th,
.chart-data td {
  padding: 9px 12px;
}
.chart-panel [data-chart-status] {
  padding: 0 24px;
  color: var(--muted);
  font-size: 12px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
footer {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  padding: 24px;
  border-top: 1px solid var(--line);
}
@media (max-width: 1100px) {
  .topbar-inner,
  .main-container {
    padding-left: 20px;
    padding-right: 20px;
  }
  .summary-grid {
    gap: 8px;
  }
  .summary-card {
    padding: 16px;
  }
  th,
  td {
    padding-left: 14px;
    padding-right: 14px;
  }
  .sites-table {
    min-width: 1000px;
  }
  .chart-grid {
    grid-template-columns: 1fr;
  }
  .two-columns {
    gap: 16px;
  }
}
@media (max-width: 680px) {
  .topbar-inner {
    flex-wrap: wrap;
    gap: 12px;
    min-height: 66px;
    padding: 14px 16px;
  }
  .brand {
    font-size: 18px;
  }
  .menu-toggle {
    display: block;
    margin-left: auto;
    border: 1px solid var(--line);
    background: white;
    border-radius: 7px;
    padding: 8px 12px;
  }
  .logout {
    margin-left: 0;
  }
  .topbar nav {
    display: none;
    order: 4;
    flex-basis: 100%;
    justify-content: space-between;
  }
  .topbar nav.open {
    display: flex;
  }
  .topbar nav a {
    padding: 9px 16px;
  }
  .main-container {
    padding: 18px 16px 32px;
  }
  .live-strip {
    margin-bottom: 24px;
    font-size: 10px;
  }
  h1 {
    font-size: 26px;
  }
  .page-heading {
    align-items: start;
    flex-direction: column;
    margin-bottom: 22px;
  }
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .summary-card:first-child {
    grid-column: 1/-1;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .summary-card strong {
    font-size: 26px;
  }
  .system-strip {
    gap: 9px;
    flex-direction: column;
  }
  .panel-heading {
    padding: 18px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .filters {
    padding: 18px;
    flex-wrap: wrap;
  }
  .filters label:first-child {
    flex-basis: 100%;
  }
  .filters label:nth-child(2) {
    min-width: 0;
    flex: 1;
  }
  .form-panel,
  .danger-zone {
    padding: 20px;
  }
  .form-grid,
  .form-grid.three,
  .two-columns {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .chart-grid {
    padding: 20px 14px;
    gap: 28px;
  }
  .chart {
    gap: 3px;
  }
  .chart-data {
    padding: 16px;
  }
  .table-footer {
    padding: 16px;
    flex-wrap: wrap;
  }
  .caption {
    font-size: 11px;
  }
  .btn {
    min-height: 42px;
  }
  .btn-small {
    min-height: 36px;
  }
  .chart-panel > .caption {
    padding: 0 16px 16px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .btn,
  .summary-card {
    transition:
      background 0.15s,
      border-color 0.15s;
  }
}
@media (max-width: 680px) {
  .sites-table {
    min-width: 0;
  }
  .sites-table thead {
    display: none;
  }
  .sites-table tbody {
    display: block;
  }
  .sites-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    padding: 12px 6px;
    border-top: 1px solid var(--line);
  }
  .sites-table td {
    display: block;
    border: 0;
    padding: 9px 12px;
  }
  .sites-table td:nth-child(3)::before {
    content: "Відповідь";
  }
  .sites-table td:nth-child(4)::before {
    content: "Остання перевірка";
  }
  .sites-table td:nth-child(5)::before {
    content: "Наступна перевірка";
  }
  .sites-table td:nth-child(3)::before,
  .sites-table td:nth-child(4)::before,
  .sites-table td:nth-child(5)::before {
    display: block;
    font-size: 10px;
    color: var(--muted);
    margin-bottom: 4px;
  }
  .sites-table td:last-child {
    grid-column: 1/-1;
  }
  .sites-table .site-url {
    max-width: 100%;
  }
  .sites-table .row-actions {
    justify-content: flex-end;
  }
  .sites-table .empty {
    grid-column: 1/-1;
  }
}

.signal-details{max-width:650px;max-height:300px;overflow:auto;font-size:13px;overflow-wrap:anywhere}
pre.signal-details{white-space:pre-wrap;font-size:12px}
.form-panel details,.form-panel h3{margin-top:20px}

.filters.monitoring-filters{display:grid;grid-template-columns:minmax(180px,1fr) minmax(190px,240px) minmax(170px,220px) auto}
.filters.monitoring-filters label:nth-child(n){min-width:0}
@media(max-width:960px){.filters.monitoring-filters{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:680px){
 .filters.monitoring-filters{grid-template-columns:minmax(0,1fr)}
 .monitoring-table thead{display:none}
 .monitoring-table tbody{display:block}
 .monitoring-table tr{display:grid;grid-template-columns:minmax(0,1fr);padding:12px 0;border-top:1px solid var(--line)}
 .monitoring-table td{display:block;border:0;padding:7px 18px;max-width:none;white-space:normal;overflow-wrap:anywhere}
 .monitoring-table td:first-child{font-size:14px;font-weight:650}
 .monitoring-table td[data-label]::before{content:attr(data-label);display:block;font-size:10px;color:var(--muted);font-weight:500;margin-bottom:4px}
 .monitoring-table .signal-details{max-width:100%}
}
