:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --border: #eceff3;
  --text: #111827;
  --muted: #6b7280;
  --faint: #9ca3af;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --green: #059669;
  --green-soft: #d1fae5;
  --amber: #f59e0b;
  --blue: #229ed9;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(17, 24, 39, .07), 0 8px 24px rgba(17, 24, 39, .05);
  --font: -apple-system, 'Segoe UI', Roboto, 'Inter', 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'Cascadia Code', 'JetBrains Mono', Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }

/* ── Nav ─────────────────────────────── */
.nav {
  max-width: 880px;
  margin: 0 auto;
  padding: 22px 20px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand { font-weight: 800; font-size: 19px; letter-spacing: -.3px; }
.brand span { color: var(--red); }
.brand-ru { color: var(--faint); font-weight: 700; }
.pill { border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 700; }
.pill.live {
  background: var(--green-soft);
  color: var(--green);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pill.live i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  animation: pulse 1.4s ease-in-out infinite;
}
.pill.live.down { background: var(--red-soft); color: var(--red); }
.pill.live.down i { background: var(--red); }

/* ── Layout ──────────────────────────── */
.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 12px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

/* ── Hero ────────────────────────────── */
.hero .status-line { display: flex; align-items: center; gap: 14px; }
.hero .dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--faint);
  flex-shrink: 0;
  animation: pulse 1.4s ease-in-out infinite;
}
.hero .dot.down { background: var(--red); box-shadow: 0 0 0 6px var(--red-soft); }
.hero .dot.up { background: var(--green); box-shadow: 0 0 0 6px var(--green-soft); }
.hero h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.6px; }
.hero-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 10px;
  font-size: 14.5px;
}
.downtime { font-weight: 700; color: var(--red); font-size: 16px; }
.downtime.ok { color: var(--green); }

/* ── Buttons ─────────────────────────── */
.btns { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  padding: 11px 18px;
  font-size: 14.5px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: var(--font);
  transition: transform .06s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn-tg { background: var(--blue); color: #fff; }
.btn-tg:hover { box-shadow: 0 6px 18px rgba(34, 158, 217, .35); }
.btn-ghost { background: var(--card); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: #fafafa; }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { box-shadow: 0 6px 18px rgba(220, 38, 38, .35); }

/* ── Metrics ─────────────────────────── */
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.metric {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.m-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--faint);
  font-weight: 700;
  min-height: 20px;
}
.m-ico { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.metric-live .live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: pulse 1.6s ease-in-out infinite; margin-left: 2px; }
.m-value { display: block; font-size: 22px; font-weight: 800; letter-spacing: -.4px; margin-top: 3px; }

/* ── Инцидент-обзор ──────────────────── */
.incident-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.beget-logo { font-size: 24px; font-weight: 800; letter-spacing: -.5px; color: #16a34a; display: inline-flex; align-items: center; }
.beget-logo i { width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-left: 5px; animation: pulse 1.4s infinite; }
.incident-tag { font-size: 11.5px; font-weight: 700; color: var(--faint); background: #f1f3f5; border-radius: 99px; padding: 4px 11px; }
.incident h2 { margin: 0 0 8px; font-size: 19px; font-weight: 800; letter-spacing: -.3px; }
.incident p { color: var(--muted); margin: 0 0 10px; font-size: 14.5px; }
.incident-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.incident-list li { font-size: 14px; padding-left: 24px; position: relative; }
.incident-list li::before { position: absolute; left: 0; }
.incident-list li.ok::before { content: '✅'; }
.incident-list li.warn::before { content: '🟡'; }
.incident-src { font-size: 13px; font-weight: 700; color: var(--blue); text-decoration: none; }
.incident-src:hover { text-decoration: underline; }

/* ── Мои сайты ───────────────────────── */
.btn-sm { padding: 7px 12px; font-size: 13px; }
.count-badge { background: var(--red-soft); color: var(--red); border-radius: 99px; font-size: 12px; font-weight: 800; padding: 2px 9px; vertical-align: 2px; }
.my-hint { font-size: 13.5px; margin: 0 0 12px; }
.add-form { display: flex; gap: 8px; margin-bottom: 12px; }
.add-input {
  flex: 1; border: 1.5px solid var(--border); border-radius: 10px; padding: 10px 14px;
  font-size: 14px; font-family: var(--font); color: var(--text); background: var(--card); outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.add-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(34, 158, 217, .15); }
.my-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.my-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #fafbfc; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; }
.my-list .st { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; background: #d1d5db; }
.my-list .st.up { background: #34d399; }
.my-list .st.down { background: var(--red); animation: pulse 1.4s infinite; }
.my-list .u { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.my-list .s { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.my-list .s.err { color: var(--red); }
.my-list .del { margin-left: auto; border: 0; background: transparent; color: var(--faint); cursor: pointer; font-size: 15px; padding: 4px 8px; border-radius: 7px; }
.my-list .del:hover { background: var(--red-soft); color: var(--red); }
.my-list .msg { color: var(--red); font-size: 13px; }

/* Блок «Ваш экран наблюдения» (персональная ссылка) */
/* display-правила выше перебивают UA-стиль [hidden], поэтому восстанавливаем его внутри секции */
.my-sites [hidden] { display: none !important; }
.share-box {
  margin: 0 0 12px;
  padding: 14px 16px;
  border: 1.5px solid rgba(34, 158, 217, .35);
  background: linear-gradient(180deg, rgba(34, 158, 217, .07), rgba(34, 158, 217, .02));
  border-radius: 12px;
}
.share-box.flash { animation: share-flash 1.6s ease; }
@keyframes share-flash {
  0% { box-shadow: 0 0 0 4px rgba(34, 158, 217, .35); border-color: var(--blue); }
  100% { box-shadow: 0 0 0 12px rgba(34, 158, 217, 0); }
}
.share-box-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.share-box-title { font-weight: 800; font-size: 15px; letter-spacing: -.2px; }
.share-badge {
  font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
  color: var(--blue); background: rgba(34, 158, 217, .12); border-radius: 99px; padding: 3px 9px;
}
.share-desc { margin: 6px 0 10px; font-size: 13.5px; color: var(--muted); }
.share-row { display: flex; gap: 8px; }
.share-input {
  flex: 1; min-width: 0;
  border: 1.5px solid var(--border); border-radius: 10px; padding: 9px 12px;
  font-size: 13px; font-family: var(--mono); color: var(--text); background: var(--card);
  text-overflow: ellipsis; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.share-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(34, 158, 217, .15); }
.share-copy { white-space: nowrap; }

/* Подпись публичного экрана /w/<token> */
.share-sub {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin: 0 0 12px;
  padding: 10px 14px;
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13.5px;
  color: var(--muted);
}
.share-sub .btn { flex-shrink: 0; }

/* ── Endpoints panel ─────────────────── */
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}
.panel h2, .timeline-card h2, .service h2, .feed-card h2 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -.3px; }
.tabs { display: inline-flex; background: #f1f3f5; border-radius: 10px; padding: 3px; }
.tab {
  border: 0;
  background: transparent;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font);
}
.tab.active { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }

.ep-row {
  display: grid;
  grid-template-columns: 130px 1fr 110px;
  gap: 6px 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}
.ep-row:last-child { border-bottom: 0; }
.ep-name {
  font-weight: 700;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ep-meta { font-size: 12.5px; text-align: right; }
.ep-meta .ms { color: var(--muted); }
.ep-meta .pct { font-weight: 800; }
.ep-meta .pct.bad { color: var(--red); }
.ep-meta .pct.good { color: var(--green); }
.ep-err {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--red);
  display: flex;
  gap: 6px;
  align-items: baseline;
}
.ep-err:empty { display: none; }
.ep-err .code { font-family: var(--mono); background: var(--red-soft); border-radius: 5px; padding: 1px 6px; font-weight: 700; }
.ep-bars { display: block; width: 100%; height: 30px; }
.ep-bars rect { rx: 1.5; }
.row-loading { padding: 18px 0; }

.legend { display: flex; gap: 14px; margin-top: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.lg { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.lg-up { background: #34d399; }
.lg-down { background: var(--red); }
.lg-partial { background: var(--amber); }
.lg-nodata { background: #e5e7eb; }

/* ── Timeline ────────────────────────── */
.timeline {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}
.timeline li { display: flex; gap: 10px; font-size: 14px; }
.timeline .tl-time {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 12.5px;
  flex-shrink: 0;
  padding-top: 1px;
}

/* ── Beget feed (стилистика Telegram) ── */
.feed-link { font-size: 13px; font-weight: 700; color: var(--blue); text-decoration: none; }
.feed-link:hover { text-decoration: underline; }
.feed {
  list-style: none;
  margin: 10px 0 0;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 380px;
  overflow-y: auto;
  background: linear-gradient(180deg, #e9eff4, #e2eaf0);
  border: 1px solid #d7e1e8;
  border-radius: 14px;
}
.tg-msg { display: flex; gap: 10px; }
.tg-ava {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #34d399, #15803d);
  color: #fff; font-weight: 800; font-size: 19px; font-style: italic;
  display: flex; align-items: center; justify-content: center;
}
.tg-body {
  background: #fff;
  border-radius: 4px 14px 14px 14px;
  padding: 9px 13px 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
  min-width: 0; max-width: 100%;
}
.tg-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tg-name { font-weight: 700; font-size: 13.5px; display: inline-flex; align-items: center; gap: 5px; }
.tg-check {
  width: 15px; height: 15px; border-radius: 50%; background: var(--blue);
  color: #fff; font-size: 10px; font-weight: 900;
  display: inline-flex; align-items: center; justify-content: center;
}
.tg-time { font-size: 11.5px; color: var(--faint); font-family: var(--mono); }
.tg-text { font-size: 13.5px; line-height: 1.45; margin-top: 3px; word-break: break-word; }
.tg-text a { color: inherit; text-decoration: none; display: block; }
.tg-text a:hover { text-decoration: underline; }
.tw-top { margin: 0; }

/* ── Service (переезд) ───────────────── */
.service-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
  align-items: center;
}
.service-badge {
  display: inline-block;
  background: var(--red-soft);
  color: var(--red);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .6px;
  border-radius: 99px;
  padding: 4px 12px;
  margin-bottom: 10px;
}
.service h2 { font-size: 24px; letter-spacing: -.5px; }
.service-lead { color: var(--muted); font-size: 15px; margin: 8px 0 14px; }
.service-list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.service-list li { font-size: 14px; color: var(--text); padding-left: 26px; position: relative; }
.service-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  top: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-lg { padding: 14px 24px; font-size: 16px; border-radius: 12px; }
.service-note { display: block; margin-top: 10px; font-size: 12.5px; color: var(--faint); }

.tw-poster { display: block; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--border); }
.tw-poster img { display: block; width: 100%; height: auto; }
.tw-wide-wrap { display: flex; justify-content: center; }
.tw-wide-wrap a { display: block; width: 100%; max-width: 890px; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--border); }
.tw-wide-wrap img { display: block; width: 100%; height: auto; }

.footer {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px 30px;
  font-size: 12.5px;
  color: var(--faint);
}

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

@media (max-width: 760px) {
  .service-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .hero h1 { font-size: 24px; }
  .metrics { grid-template-columns: 1fr; }
  .ep-row { grid-template-columns: 1fr; gap: 6px; }
  .ep-meta { text-align: left; }
  .card { padding: 18px; }
  .service h2 { font-size: 21px; }
  .share-box { padding: 12px 14px; }
  .share-row { flex-direction: column; }
  .share-copy { width: 100%; }
  .share-sub { flex-direction: column; align-items: flex-start; }
}
