:root {
  --bg: #14161b; --card: #1c1f26; --card2: #21252e; --border: #2c313c;
  --fg: #e8eaf0; --muted: #9aa1b1; --accent: #f5c542; --green: #3ecf6f;
  --gray: #6b7280; --red: #ef5f5f; --link: #7cb7ff;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--link); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 18px 60px; }

/* ---- шапка ---- */
header { text-align: center; padding: 26px 0 8px; }
header h1 { margin: 0; font-size: 2.1rem; letter-spacing: .5px; }
header h1 .chz { color: var(--accent); }
header p { color: var(--muted); margin: 8px 0 0; }
#upd { color: var(--muted); font-size: .9rem; display: inline-block; margin-top: 6px; }
.legend {
  display: flex; gap: 16px; justify-content: center; margin: 14px 0 0;
  flex-wrap: wrap; font-size: .88rem; color: var(--muted);
}
.legend .hint { opacity: .7; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot.up { background: var(--green); box-shadow: 0 0 6px rgba(62,207,111,.7); }
.dot.down { background: var(--red); box-shadow: 0 0 6px rgba(239,95,95,.7); }
.dot.planned { background: var(--gray); }
.dot.unknown { background: #444a58; }

/* ---- сетка карточек ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; margin-top: 18px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px; display: flex; flex-direction: column; gap: 10px;
  transition: transform .12s ease, border-color .12s ease;
  cursor: pointer; text-align: left; font: inherit; color: inherit;
}
.card:hover, .card:focus-visible { transform: translateY(-2px); border-color: #3a4150; outline: none; }
.card:focus-visible { box-shadow: 0 0 0 2px rgba(245,197,66,.45); }
.card.planned { opacity: .62; }
.card-head { display: flex; align-items: center; gap: 12px; }
.icon {
  font-size: 1.9rem; width: 46px; height: 46px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--card2); border-radius: 12px;
}
.card h2 { margin: 0; font-size: 1.12rem; }
.card .host { color: var(--muted); font-size: .82rem; font-weight: 400; }
.badge {
  display: inline-block; font-size: .72rem; background: #2a2f3a; color: var(--muted);
  border: 1px solid var(--border); border-radius: 20px; padding: 1px 9px;
  margin-left: 6px; vertical-align: middle;
}
.status { font-size: .78rem; color: var(--muted); display: block; margin-top: 3px; }
.status::before {
  content: ""; display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; margin-right: 5px; background: #444a58;
}
.status.ok::before { background: var(--green); }
.status.bad::before { background: var(--red); }
.status.pl::before { background: var(--gray); }
.desc { margin: 0; color: #c6cbd6; font-size: .93rem; flex: 1; }
.card-actions { display: flex; gap: 10px; align-items: center; }
.btn {
  display: inline-block; padding: 7px 14px; border-radius: 9px; text-decoration: none;
  font-size: .87rem; font-weight: 600; border: 1px solid transparent;
}
.btn.primary { background: var(--accent); color: #20242c; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--muted); border-color: var(--border); cursor: pointer; font: inherit; font-size: .87rem; }
.btn.ghost:hover { color: var(--fg); border-color: #3a4150; }
.noscript { color: var(--muted); grid-column: 1 / -1; }

/* ---- модалка ---- */
.overlay {
  position: fixed; inset: 0; background: rgba(8,10,13,.72);
  display: flex; align-items: center; justify-content: center; padding: 18px;
  z-index: 50; backdrop-filter: blur(3px);
}
.overlay[hidden] { display: none; }
.modal {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  max-width: 720px; width: 100%; max-height: 88vh; overflow: auto;
  position: relative; padding: 22px 24px 18px;
  animation: pop .14s ease;
}
@keyframes pop { from { transform: scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-close {
  position: absolute; top: 10px; right: 12px; width: 34px; height: 34px;
  background: transparent; color: var(--muted); border: none; border-radius: 8px;
  font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.modal-close:hover { background: var(--card2); color: var(--fg); }
.modal-head { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; padding-right: 30px; }
.modal-head h2 { margin: 0; font-size: 1.35rem; }
.modal-head .host { color: var(--muted); font-size: .85rem; }
.modal-head .status { margin-top: 4px; }
.modal-body h3 {
  margin: 18px 0 8px; font-size: .8rem; text-transform: uppercase;
  letter-spacing: .8px; color: var(--accent);
}
.modal-body p { margin: 0 0 8px; color: #c6cbd6; font-size: .95rem; }
.client-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.client-list li {
  background: var(--card2); border-radius: 10px; padding: 9px 12px;
  font-size: .9rem; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline;
}
.client-list .platform {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .5px;
  color: var(--accent); min-width: 130px; flex: none;
}
.client-list a { color: var(--link); text-decoration: none; font-weight: 600; }
.client-list a:hover { text-decoration: underline; }
.client-list .note { color: var(--muted); font-size: .85rem; width: 100%; }
.info-block { background: var(--card2); border-radius: 10px; padding: 12px 14px; font-size: .9rem; }
.info-block + .info-block { margin-top: 10px; }
.info-block b { color: var(--fg); }
.info-block .lbl { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .8px; color: var(--accent); margin-bottom: 4px; }
.modal-foot {
  margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border);
  font-size: .87rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 14px;
}
.modal-foot a { text-decoration: none; }
.modal-foot a:hover { text-decoration: underline; }

footer { margin-top: 34px; text-align: center; color: var(--muted); font-size: .85rem; }
footer a { text-decoration: none; }
footer a:hover { text-decoration: underline; }

@media (max-width: 420px) {
  .grid { grid-template-columns: 1fr; }
  .modal { padding: 18px 16px 14px; }
  .client-list .platform { min-width: 0; }
}
