:root {
  --bg: #f3f5fb;
  --card: #ffffff;
  --ink: #131629;
  --dim: #82869e;
  --line: #e9eaf2;
  --accent: #5a5bd8;
  --accent-deep: #4344c0;
  --accent-soft: #eeeefc;
  --green: #17a34a;
  --green-soft: #e7f8ee;
  --orange: #d97706;
  --orange-soft: #fdf3e3;
  --red: #e11d48;
  --red-soft: #fdebef;
  --grad-side: linear-gradient(178deg, #1b1747 0%, #221a5e 45%, #2b1e78 100%);
  --radius: 14px;
  --shadow-card: 0 1px 2px rgba(19, 22, 41, .04), 0 8px 24px -12px rgba(19, 22, 41, .10);
  --sp-1: 8px; --sp-2: 12px; --sp-3: 16px; --sp-4: 24px; --sp-5: 32px;
}
* { box-sizing: border-box; margin: 0; }
body {
  font: 14px/1.5 Inter, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
a { color: var(--accent); text-decoration: none; }
button { font: inherit; cursor: pointer; }
.ic { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ---------- layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 226px; flex-shrink: 0; background: var(--grad-side); color: #c9c9e8;
  display: flex; flex-direction: column; padding: 20px 14px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 11px; align-items: center; color: #fff; padding: 2px 8px 22px; }
.brand strong { font-size: 14px; letter-spacing: .04em; }
.brand small { display: block; color: #8f8fc0; font-size: 11px; font-weight: 500; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 11px;
  color: #c9c9e8; padding: 10px 13px; border-radius: 10px; font-weight: 500;
  transition: background .15s, color .15s;
}
.sidebar nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.sidebar nav a.active {
  background: rgba(255, 255, 255, .14); color: #fff; font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14);
}
.sidebar-foot { margin-top: auto; }
.lang-switch { display: flex; gap: 6px; padding: 6px 13px 8px; }
.lang-switch a { color: #8f8fc0; font-weight: 700; font-size: 12px; padding: 3px 9px; border-radius: 7px; border: 1px solid transparent; }
.lang-switch a.on { color: #fff; border-color: rgba(255, 255, 255, .28); background: rgba(255, 255, 255, .1); }
.sidebar-foot a { display: flex; align-items: center; gap: 11px; color: #8f8fc0; padding: 10px 13px; border-radius: 10px; }
.sidebar-foot a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.main { flex: 1; padding: var(--sp-4) 28px; min-width: 0; }

/* ---------- page head ---------- */
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--sp-4); gap: var(--sp-2); flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.page-head p { color: var(--dim); margin-top: 2px; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.head-search { position: relative; }
.head-search .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--dim); width: 15px; height: 15px; }
.head-search input {
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px 9px 34px;
  width: 230px; font: inherit; background: var(--card); box-shadow: var(--shadow-card);
}
.head-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 9px 15px; border-radius: 10px; font-weight: 600; font-size: 13.5px;
  box-shadow: var(--shadow-card); transition: border-color .15s, color .15s, background .15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-deep); color: #fff; }
.btn-xs { padding: 5px 8px; font-size: 12px; border-radius: 8px; box-shadow: none; gap: 5px; }
.btn-xs .ic { width: 14px; height: 14px; }
.btn-danger:hover { border-color: var(--red); color: var(--red); }
.bell-active { color: var(--accent); }
.bell-muted { color: var(--dim); opacity: .75; }

/* ---------- stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-4); }
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: flex; gap: 13px; align-items: flex-start; box-shadow: var(--shadow-card);
}
.stat-card small { color: var(--dim); display: block; font-size: 12px; font-weight: 600; }
.stat-card strong { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.25; }
.stat-card.muted { opacity: .62; }
.stat-ico {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  font-weight: 700; font-size: 15px; flex-shrink: 0;
}
.stat-ico .ic { width: 19px; height: 19px; }
.stat-ico.blue { background: var(--accent-soft); color: var(--accent); }
.stat-ico.green { background: var(--green-soft); color: var(--green); }
.stat-ico.orange { background: var(--orange-soft); color: var(--orange); }
.stat-ico.red { background: var(--red-soft); color: var(--red); }
.stat-ico.purple { background: #f3ecfe; color: #8b45db; }
.chip { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 700; border-radius: 99px; padding: 2px 8px; margin-top: 3px; }
.chip.up { background: var(--green-soft); color: var(--green); }
.chip.down { background: var(--red-soft); color: var(--red); }
.chip.flat { background: var(--line); color: var(--dim); }

/* ---------- cards & columns ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: var(--sp-3); box-shadow: var(--shadow-card);
}
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.card-head h2 { font-size: 15.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.count-chip { background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; border-radius: 99px; padding: 2px 9px; }
.card-tools { display: flex; gap: 8px; align-items: center; }
.two-col { display: flex; gap: var(--sp-3); align-items: flex-start; }
.two-col .grow { flex: 1; min-width: 0; }
.side-col { width: 308px; flex-shrink: 0; display: flex; flex-direction: column; }
@media (max-width: 1150px) { .two-col { flex-direction: column; } .side-col { width: 100%; } }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--dim); padding: 9px 10px; border-bottom: 1px solid var(--line); font-weight: 700; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 13.5px; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #f8f9fe; }
tr:last-child td { border-bottom: 0; }
.site-link { font-weight: 600; color: var(--ink); display: inline-flex; align-items: center; gap: 6px; }
.site-link:hover { color: var(--accent); }
.site-link .ic { width: 12px; height: 12px; opacity: 0; transition: opacity .15s; }
.site-link:hover .ic { opacity: .7; }
.thumb { width: 84px; height: 50px; object-fit: cover; object-position: top; border: 1px solid var(--line); border-radius: 7px; display: block; background: #eef0f6; }
.dim { color: var(--dim); font-size: 12.5px; }
.row-actions { display: flex; gap: 5px; }
.row-actions form { display: inline; }
.row-resolved { opacity: .55; }
td .spark { display: inline-block; vertical-align: middle; margin-left: 7px; }
.spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.6; }
.spark circle { fill: var(--accent); }
.spark rect { fill: var(--accent); opacity: .8; }

/* pagination */
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.pager-info { color: var(--dim); font-size: 12.5px; }
.pager-pages { display: flex; gap: 5px; align-items: center; }
.page-btn {
  min-width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); font-weight: 600; font-size: 13px; color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; padding: 0 8px;
}
.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager select { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font: inherit; font-size: 13px; background: var(--card); }

/* dropdown menus (filters / columns) */
.menu-wrap { position: relative; }
.menu {
  display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 50;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 34px -8px rgba(19, 22, 41, .18); padding: 8px; min-width: 170px;
}
.menu.open { display: block; }
.menu label, .menu button.opt {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: 8px; border: 0; background: none;
  font-size: 13.5px; font-weight: 500; color: var(--ink); cursor: pointer;
}
.menu label:hover, .menu button.opt:hover { background: var(--accent-soft); }
.menu button.opt.on { color: var(--accent); font-weight: 700; }
.menu-title { display: block; padding: 8px 10px 3px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--dim); font-weight: 700; }

/* sortable headers */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--accent); }
th.sortable::after { content: "↕"; opacity: .35; margin-left: 5px; font-size: 11px; }
th.sortable.sort-asc::after { content: "↑"; opacity: 1; color: var(--accent); }
th.sortable.sort-desc::after { content: "↓"; opacity: 1; color: var(--accent); }

/* ---------- pills & lights ---------- */
.pill { padding: 3px 11px; border-radius: 99px; font-size: 12px; font-weight: 700; text-transform: capitalize; }
.pill-online { background: var(--green-soft); color: var(--green); }
.pill-issues { background: var(--orange-soft); color: var(--orange); }
.pill-offline { background: var(--red-soft); color: var(--red); }
.pill-unknown { background: var(--line); color: var(--dim); }
.badge-red { background: var(--red); color: #fff; border-radius: 99px; padding: 1px 7px; font-size: 11px; font-weight: 700; }
.status-cell { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.light { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.light-online { background: var(--green); box-shadow: 0 0 6px 1px rgba(23, 163, 74, .5); }
.light-issues { background: var(--orange); box-shadow: 0 0 6px 1px rgba(217, 119, 6, .5); animation: blink 1.4s infinite; }
.light-offline { background: var(--red); box-shadow: 0 0 7px 2px rgba(225, 29, 72, .55); animation: blink .7s infinite; }
.light-unknown { background: #c6c8d6; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .15; } }
@media (prefers-reduced-motion: reduce) { .light-issues, .light-offline { animation: none; } }
.http-code { font: 600 11px/1 ui-monospace, "SF Mono", Consolas, monospace; padding: 3px 6px; border-radius: 5px; }
.code-ok { background: var(--green-soft); color: var(--green); }
.code-bad { background: var(--red-soft); color: var(--red); }

/* ---------- alerts rail ---------- */
.alert-list { list-style: none; display: flex; flex-direction: column; }
.alert-list li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.alert-list li:last-child { border-bottom: 0; }
.alert-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; background: var(--orange); }
.sev-critical .alert-dot { background: var(--red); }
.alert-body { flex: 1; min-width: 0; }
.alert-body strong { font-size: 13px; display: block; }
.alert-body span { font-size: 12.5px; color: var(--ink); opacity: .85; display: block; overflow: hidden; text-overflow: ellipsis; }
.alert-body em { font-style: normal; color: var(--dim); font-size: 11px; }
.alert-thumb { width: 52px; height: 36px; object-fit: cover; object-position: top; border-radius: 6px; border: 1px solid var(--line); flex-shrink: 0; background: #eef0f6; }

/* ---------- integrations ---------- */
.integration-list { list-style: none; display: flex; flex-direction: column; }
.integration-list li { display: flex; justify-content: space-between; align-items: center; padding: 9px 2px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 13.5px; }
.integration-list li:last-child { border-bottom: 0; }
.integration-list .int-name { display: flex; align-items: center; gap: 9px; }
.int-dot { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; }

/* ---------- forms ---------- */
.search-input { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; width: 220px; font: inherit; }
.search-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.add-form textarea, .settings-grid input, .settings-grid textarea, .inline-edit input {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font: inherit;
}
.add-form textarea:focus, .settings-grid input:focus, .settings-grid textarea:focus, .inline-edit input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.add-form-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.add-form-row input { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font: inherit; }
.inline-edit { display: flex; gap: 6px; align-items: center; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: var(--sp-3); }
.settings-grid label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 12px; color: var(--dim); }
.flash-ok { background: var(--green-soft); color: var(--green); padding: 11px 15px; border-radius: 10px; margin-bottom: 14px; font-weight: 600; }

/* ---------- screenshots gallery ---------- */
.shot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(238px, 1fr)); gap: var(--sp-3); }
.shot-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-card); }
.shot-card.shot-issue { border-color: var(--orange); box-shadow: 0 0 0 1px var(--orange), var(--shadow-card); }
.shot-card img { width: 100%; height: 158px; object-fit: cover; object-position: top; display: block; background: #eef0f6; }
.shot-missing { height: 158px; display: grid; place-items: center; background: var(--red-soft); color: var(--red); font-weight: 700; }
.shot-card figcaption { padding: 11px 13px; display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.shot-card em { font-style: normal; color: var(--dim); font-size: 11px; }

/* ---------- login ---------- */
.login-body { display: grid; place-items: center; min-height: 100vh; background: var(--grad-side); font: 14px/1.5 Inter, -apple-system, "Segoe UI", Roboto, sans-serif; }
.login-card {
  background: var(--card); padding: 32px; border-radius: 18px; width: 350px;
  display: flex; flex-direction: column; gap: 13px; box-shadow: 0 24px 60px -12px rgba(0, 0, 0, .45);
}
.login-card .brand { color: var(--ink); }
.login-card label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 12px; color: var(--dim); }
.login-card input { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; }
.login-card input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.login-error { background: var(--red-soft); color: var(--red); padding: 9px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; }
.remember-row { flex-direction: row !important; align-items: center; gap: 8px !important; font-weight: 500 !important; }
.remember-row input { width: auto; }

/* ---------- hover-zoom preview ---------- */
.hover-preview {
  display: none; position: fixed; z-index: 1000; pointer-events: none;
  width: min(52vw, 900px); max-height: calc(100vh - 24px); overflow: hidden;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 22px 60px rgba(19, 22, 41, .38);
}
.hover-preview img { width: 100%; display: block; }
