/* Оформление статус-страницы. Акцент и монограмма подставляются генератором из
   домена — одна таблица стилей темизируется под конкретный узел, поэтому цвета
   заданы через переменные, а не хардкодом по месту. */

:root {
  --accent: #8132bd;
  --accent-600: #69279b;
  --accent-050: #f6effb;

  --bg: #f6f8fa;
  --panel: #ffffff;
  --border: #e3e8ee;
  --text: #1b2330;
  --muted: #5b6875;
  --shadow: 0 1px 2px rgba(20, 30, 45, .06), 0 1px 3px rgba(20, 30, 45, .05);

  --ok: #1f9d57;
  --ok-bg: #e7f6ec;
  --degraded: #b7791f;
  --degraded-bg: #fbf1dd;
  --maint: #2b6cb0;
  --maint-bg: #e6f0fb;
  --outage: #c0392b;
  --outage-bg: #fbe9e7;

  --radius: 10px;
  --max: 760px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141a;
    --panel: #161c24;
    --border: #242c37;
    --text: #e7ecf2;
    --muted: #93a1b1;
    --shadow: none;

    --ok-bg: #12271b;
    --degraded-bg: #2a2211;
    --maint-bg: #10202f;
    --outage-bg: #2a1512;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-600); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 28px 20px 56px; }

/* --- шапка --- */
.masthead {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.logo {
  width: 40px; height: 40px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700;
  letter-spacing: .5px;
  font-size: 15px;
  flex: none;
}
.masthead h1 { font-size: 18px; margin: 0; font-weight: 650; }
.masthead .tagline { color: var(--muted); font-size: 13px; margin-top: 1px; }
.masthead nav { margin-left: auto; display: flex; gap: 4px; }
.masthead nav a {
  padding: 6px 12px; border-radius: 7px; color: var(--muted); font-size: 14px;
}
.masthead nav a.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }

/* --- крупный баннер состояния --- */
.banner {
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow);
  border: 1px solid transparent;
  margin-bottom: 22px;
}
.banner__dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.banner__label { font-size: 17px; font-weight: 600; }
.banner__conn { margin-left: auto; }

.banner[data-state="operational"] { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 22%, transparent); }
.banner[data-state="operational"] .banner__dot { background: var(--ok); }
.banner[data-state="degraded"]    { background: var(--degraded-bg); border-color: color-mix(in srgb, var(--degraded) 22%, transparent); }
.banner[data-state="degraded"] .banner__dot { background: var(--degraded); }
.banner[data-state="maintenance"] { background: var(--maint-bg); border-color: color-mix(in srgb, var(--maint) 22%, transparent); }
.banner[data-state="maintenance"] .banner__dot { background: var(--maint); }

/* индикатор живого соединения — суть артефакта: видно, что канал держится */
.conn {
  font-size: 12.5px; font-weight: 500; color: var(--muted);
  display: inline-flex; align-items: center; gap: 6px;
}
.conn::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted);
}
.conn[data-mode="live"] { color: var(--ok); }
.conn[data-mode="live"]::before { background: var(--ok); animation: pulse 2.4s ease-in-out infinite; }
.conn[data-mode="reconnecting"] { color: var(--degraded); }
.conn[data-mode="reconnecting"]::before { background: var(--degraded); animation: blink 1s steps(2) infinite; }
.conn[data-mode="polling"] { color: var(--maint); }
.conn[data-mode="polling"]::before { background: var(--maint); }

@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(31,157,87,.5); } 50% { box-shadow: 0 0 0 5px rgba(31,157,87,0); } }
@keyframes blink { 50% { opacity: .25; } }

/* --- панель компонентов --- */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 22px;
}
.panel__head {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.panel__head h2 { font-size: 14px; margin: 0; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

.components { list-style: none; margin: 0; padding: 0; }
.component {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}
.component:first-child { border-top: none; }
.component__name { font-weight: 550; }
.component__meta { margin-left: auto; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.component__meta .sep { opacity: .5; margin: 0 6px; }

.pill {
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 20px;
  white-space: nowrap;
}
.pill[data-state="operational"] { color: var(--ok); background: var(--ok-bg); }
.pill[data-state="degraded"]    { color: var(--degraded); background: var(--degraded-bg); }
.pill[data-state="maintenance"] { color: var(--maint); background: var(--maint-bg); }

/* --- 90-дневная лента аптайма --- */
.uptime { padding: 16px 18px; }
.uptime__row { display: flex; align-items: flex-end; gap: 2px; height: 34px; }
.uptime__day { flex: 1 1 0; border-radius: 2px; height: 100%; background: var(--ok); min-width: 2px; }
.uptime__day[data-state="operational"] { background: color-mix(in srgb, var(--ok) 55%, var(--panel)); }
.uptime__day[data-state="degraded"] { background: var(--degraded); }
.uptime__day[data-state="maintenance"] { background: var(--maint); }
.uptime__day[data-state="outage"] { background: var(--outage); }
.uptime__legend {
  display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 8px;
}

/* --- регионы --- */
.regions { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0 2px; }
.region {
  font-size: 12.5px; color: var(--muted);
  border: 1px solid var(--border); border-radius: 20px; padding: 3px 11px;
  display: inline-flex; align-items: center; gap: 6px;
}
.region::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }

/* --- история инцидентов --- */
.incidents { list-style: none; margin: 0; padding: 0; }
.incident { border-top: 1px solid var(--border); padding: 18px; }
.incident:first-child { border-top: none; }
.incident__title { font-weight: 600; font-size: 15px; margin: 0 0 4px; display: flex; align-items: baseline; gap: 10px; }
.incident__meta { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.sev { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 5px; }
.sev[data-sev="minor"] { color: var(--degraded); background: var(--degraded-bg); }
.sev[data-sev="major"] { color: var(--outage); background: var(--outage-bg); }
.sev[data-sev="maintenance"] { color: var(--maint); background: var(--maint-bg); }

.updates { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.update { position: relative; padding: 0 0 12px 16px; }
.update:last-child { padding-bottom: 0; }
.update::before {
  content: ""; position: absolute; left: -5px; top: 5px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
}
.update__status { font-weight: 600; font-size: 13px; text-transform: capitalize; }
.update__time { color: var(--muted); font-size: 12px; margin-left: 8px; }
.update__text { font-size: 13.5px; margin-top: 2px; }

.month-sep { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; margin: 26px 2px 8px; font-weight: 600; }

.empty { padding: 40px 18px; text-align: center; color: var(--muted); }

/* --- 404 --- */
.notfound { text-align: center; padding: 60px 18px; }
.notfound .code { font-size: 56px; font-weight: 700; color: var(--accent); line-height: 1; }
.notfound h2 { font-size: 20px; margin: 14px 0 6px; }
.notfound p { color: var(--muted); margin: 0 0 20px; }
.btn {
  display: inline-block; background: var(--accent); color: #fff; padding: 9px 18px;
  border-radius: 8px; font-weight: 550; font-size: 14px;
}
.btn:hover { background: var(--accent-600); text-decoration: none; }

/* --- подвал --- */
.foot { color: var(--muted); font-size: 12.5px; margin-top: 26px; display: flex; gap: 14px; flex-wrap: wrap; }
.foot a { color: var(--muted); }

@media (max-width: 460px) {
  .masthead { flex-wrap: wrap; }
  .masthead nav { margin-left: 0; width: 100%; }
  .component { flex-wrap: wrap; }
  .component__meta { margin-left: 0; width: 100%; order: 3; }
}
