:root {
  --bg: #050706;
  --card: #0b0f0d;
  --card-2: #101512;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #f2f5f3;
  --muted: rgba(242, 245, 243, 0.62);
  --faint: rgba(242, 245, 243, 0.4);
  --green: #34b06f;
  --green-2: #3dff9a;
  --ok: #2fbf71;
  --ok-soft: #1f7a4b;
  --degraded: #f2c94c;
  --partial: #f2994a;
  --down: #eb5757;
  --maintenance: #56a8f5;
  --nodata: #1e2421;
  --radius: 16px;
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  min-height: 100vh;
  background:
    radial-gradient(60% 40% at 0% 0%, rgba(38, 150, 92, 0.18), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}

a { color: inherit; }

.wrap {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── шапка ── */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 0 36px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 600;
  font-size: 18px;
}

.brand svg { width: 30px; height: 34px; filter: drop-shadow(0 0 8px rgba(61, 255, 154, 0.35)); }

.brand small {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.top-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  font-size: 13px;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
}

.top-link:hover { background: var(--green); border-color: var(--green); }

/* ── общий статус ── */
.banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 24px;
  border-radius: var(--radius);
  background: var(--ok-soft);
  box-shadow: 0 10px 40px rgba(47, 191, 113, 0.18);
}

.banner .icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  font-size: 20px;
  font-weight: 700;
}

.banner h1 { margin: 0; font-size: clamp(18px, 2.4vw, 24px); font-weight: 600; }
.banner p { margin: 4px 0 0; font-size: 13px; opacity: 0.8; }

.banner.degraded { background: #7a6420; box-shadow: 0 10px 40px rgba(242, 201, 76, 0.15); }
.banner.partial { background: #8a4f1c; box-shadow: 0 10px 40px rgba(242, 153, 74, 0.16); }
.banner.down { background: #8c2626; box-shadow: 0 10px 40px rgba(235, 87, 87, 0.2); }
.banner.maintenance { background: #1f4f7a; box-shadow: 0 10px 40px rgba(86, 168, 245, 0.16); }

/* ── активные инциденты ── */
.active { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }

.active-card {
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--partial);
}

.active-card.impact-critical { border-left-color: var(--down); }
.active-card.impact-minor { border-left-color: var(--degraded); }
.active-card.impact-maintenance { border-left-color: var(--maintenance); }

.active-card a.title { font-size: 17px; font-weight: 600; text-decoration: none; }
.active-card a.title:hover { color: var(--green-2); }
.active-card .upd { margin: 10px 0 0; font-size: 14px; line-height: 1.55; color: var(--muted); }
.active-card .upd b { color: var(--text); }
.active-card time { display: block; margin-top: 6px; font-size: 12px; color: var(--faint); }

/* ── компоненты ── */
.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 44px 0 14px;
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
}

.legend { display: flex; gap: 14px; flex-wrap: wrap; text-transform: none; letter-spacing: 0; font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.group {
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  overflow: hidden;
}

.group + .group { margin-top: 14px; }

.group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 16px 20px;
  background: var(--card-2);
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.group-head .chev { transition: transform 0.25s; color: var(--faint); }
.group.collapsed .group-head .chev { transform: rotate(-90deg); }
.group.collapsed .group-body { display: none; }

.comp { padding: 18px 20px; }
.comp + .comp { border-top: 1px solid var(--line); }

.comp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.comp-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  background: none;
  border: 0;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}

.comp-name:hover { color: var(--green-2); }
.comp-name .hint { font-size: 12px; font-weight: 400; color: var(--faint); }

.st { font-size: 13px; font-weight: 500; white-space: nowrap; }
.st.operational { color: var(--ok); }
.st.degraded { color: var(--degraded); }
.st.partial { color: var(--partial); }
.st.down { color: var(--down); }
.st.maintenance { color: var(--maintenance); }
.st.unknown { color: var(--faint); }

.bars {
  display: flex;
  gap: 2px;
  height: 34px;
}

.bar {
  flex: 1;
  min-width: 2px;
  border-radius: 2px;
  background: var(--nodata);
  transition: opacity 0.15s, transform 0.15s;
}

.bar:hover { opacity: 0.75; transform: scaleY(1.08); }
.bar.u-ok { background: var(--ok); }
.bar.u-good { background: #9bd36a; }
.bar.u-degraded { background: var(--degraded); }
.bar.u-partial { background: var(--partial); }
.bar.u-down { background: var(--down); }

.bars-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--faint);
}

.bars-foot .line { flex: 1; height: 1px; background: var(--line); }
.bars-foot .uptime { color: var(--muted); }

.detail {
  margin-top: 16px;
  padding: 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
}

.detail-stats { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.detail-stats b { color: var(--text); font-weight: 600; }
.detail-err { color: var(--down); }

.chart { width: 100%; height: 120px; display: block; }
.chart .grid { stroke: var(--line); }
.chart .area { fill: url(#latGrad); }
.chart .lineP { fill: none; stroke: var(--green); stroke-width: 1.6; }
.chart .fail { fill: var(--down); }
.chart text { fill: var(--faint); font-size: 10px; font-family: inherit; }

.sys { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.sys > div { padding: 12px 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); }
.sys small { display: block; font-size: 12px; color: var(--faint); }
.sys b { display: block; margin-top: 4px; font-size: 20px; font-weight: 600; }
.sys .meter { height: 4px; margin-top: 8px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.sys .meter i { display: block; height: 100%; background: var(--green); }
.sys .meter i.warn { background: var(--degraded); }
.sys .meter i.bad { background: var(--down); }

/* ── всплывающая подсказка по дню ── */
.tip {
  position: fixed;
  z-index: 50;
  max-width: 260px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #151b18;
  border: 1px solid var(--line-2);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  font-size: 13px;
  line-height: 1.45;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s, transform 0.12s;
}

.tip.show { opacity: 1; transform: none; }
.tip .d { font-weight: 600; }
.tip .u { color: var(--muted); }
.tip ul { margin: 8px 0 0; padding-left: 16px; color: var(--partial); }

/* ── история инцидентов ── */
.days { display: flex; flex-direction: column; }

.day {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.day h3 { margin: 0 0 10px; font-size: 15px; font-weight: 600; }
.day .none { margin: 0; font-size: 14px; color: var(--faint); }

.inc { margin-top: 12px; }
.inc a { font-weight: 600; text-decoration: none; }
.inc a:hover { text-decoration: underline; }
.inc.impact-major a, .inc.impact-partial a { color: var(--partial); }
.inc.impact-critical a { color: var(--down); }
.inc.impact-minor a { color: var(--degraded); }
.inc.impact-maintenance a { color: var(--maintenance); }
.inc.impact-none a { color: var(--text); }
.inc p { margin: 6px 0 0; font-size: 14px; line-height: 1.55; color: var(--muted); }
.inc time { display: block; margin-top: 4px; font-size: 12px; color: var(--faint); }

.more {
  display: inline-flex;
  margin: 24px 0 0;
  font-size: 14px;
  color: var(--green-2);
  text-decoration: none;
}

.more:hover { text-decoration: underline; }

/* ── страница инцидента ── */
.back { display: inline-block; margin-bottom: 18px; font-size: 14px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--text); }

.inc-head h1 { margin: 0 0 12px; font-size: clamp(22px, 3vw, 32px); font-weight: 600; }

.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.badge { padding: 6px 12px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line-2); color: var(--muted); }
.badge.impact { color: #fff; border: 0; background: var(--partial); }
.badge.impact.critical { background: var(--down); }
.badge.impact.minor { background: #8a7224; }
.badge.impact.maintenance { background: #1f4f7a; }
.badge.impact.none { background: #2a312d; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 16px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.timeline .s { font-weight: 600; }
.timeline .s.resolved { color: var(--ok); }
.timeline .s.investigating { color: var(--partial); }
.timeline .s.identified { color: var(--degraded); }
.timeline .s.monitoring { color: var(--maintenance); }
.timeline p { margin: 0 0 6px; line-height: 1.6; white-space: pre-wrap; }
.timeline time { font-size: 12px; color: var(--faint); }

.empty { padding: 40px 0; color: var(--faint); text-align: center; }

.foot {
  margin: 56px 0 0;
  padding: 24px 0 40px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  font-size: 12px;
  color: var(--faint);
}

.foot a { color: var(--muted); }

.skeleton { height: 90px; border-radius: var(--radius); background: linear-gradient(90deg, var(--card), var(--card-2), var(--card)); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* на телефоне — последние 30 дней, как на status-страницах */
@media (max-width: 640px) {
  .bars .bar:nth-child(-n + 60) { display: none; }
  .bars-foot .from-90 { display: none; }
  .bars-foot .from-30 { display: inline; }
  .sys { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .comp-name .hint { display: none; }
  .timeline li { grid-template-columns: 1fr; gap: 6px; }
  .top { padding: 20px 0 24px; }
}

@media (min-width: 641px) {
  .bars-foot .from-30 { display: none; }
}
