/* VisualWatch — dark ops console */
:root {
  --bg: #0b0e13;
  --bg2: #10141c;
  --panel: #141923;
  --panel2: #1a2030;
  --line: #232b3b;
  --line2: #2e3950;
  --text: #e7ecf5;
  --mut: #8b97ad;
  --dim: #5b6678;
  --accent: #c8f04a;
  --accent-dim: rgba(200, 240, 74, .12);
  --red: #ff4d6d;
  --red-dim: rgba(255, 77, 109, .12);
  --amber: #ffb547;
  --amber-dim: rgba(255, 181, 71, .12);
  --green: #3ddc97;
  --green-dim: rgba(61, 220, 151, .1);
  --blue: #5aa2ff;
  --mono: 'IBM Plex Mono', monospace;
  --sans: 'Archivo', sans-serif;
  --r: 10px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  background-image:
    radial-gradient(1200px 500px at 80% -10%, rgba(90,162,255,.06), transparent 60%),
    radial-gradient(900px 400px at -10% 110%, rgba(200,240,74,.05), transparent 60%);
}
::selection { background: var(--accent); color: #0b0e13; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

.app { display: flex; min-height: 100vh; }

/* ---------- sidebar ---------- */
.sidebar {
  width: 232px; flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 22px 18px 18px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, #1a2030, #0d1117);
  border: 1px solid var(--line2);
  display: grid; place-items: center; position: relative;
}
.brand-mark span {
  width: 14px; height: 14px; border-radius: 50%;
  border: 3px solid var(--accent);
  display: block; position: relative;
}
.brand-mark span::after {
  content: ''; position: absolute; inset: 2.5px;
  border-radius: 50%; background: var(--accent);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { transform: scale(.6); opacity:.6 } 50% { transform: scale(1); opacity:1 } }
.brand-text { font-size: 16px; font-weight: 500; letter-spacing: .2px; line-height: 1.1; }
.brand-text b { font-weight: 800; }
.brand-text small { display: block; font-family: var(--mono); font-size: 9.5px; color: var(--dim); letter-spacing: 1.6px; text-transform: uppercase; margin-top: 3px; }

.nav { padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 8px;
  color: var(--mut); text-decoration: none;
  font-weight: 500; font-size: 13.5px;
  transition: all .15s;
  border: 1px solid transparent;
}
.nav a i { font-style: normal; width: 16px; text-align: center; font-size: 13px; opacity: .8; }
.nav a:hover { color: var(--text); background: var(--panel); }
.nav a.active {
  color: var(--accent); background: var(--accent-dim);
  border-color: rgba(200,240,74,.18);
}
.nav-badge {
  margin-left: auto; background: var(--red); color: #fff;
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  padding: 1px 7px; border-radius: 99px;
}
.sidebar-foot { margin-top: auto; padding: 14px; }
.runbox { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.runbox-label { font-family: var(--mono); font-size: 10px; letter-spacing: 2px; color: var(--accent); margin-bottom: 6px; }
.blink { animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0 } }
.runbox-current { font-size: 12px; color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 8px; }
.progress { height: 5px; background: var(--line); border-radius: 4px; overflow: hidden; }
.progress-bar { height: 100%; width: 0%; background: var(--accent); border-radius: 4px; transition: width .4s; }
.runbox-count { font-family: var(--mono); font-size: 11px; color: var(--dim); margin-top: 7px; text-align: right; }

/* ---------- main ---------- */
.main { flex: 1; padding: 28px 34px 60px; max-width: 1480px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 25px; font-weight: 800; letter-spacing: -.4px; }
.page-head .sub { color: var(--mut); font-size: 13px; margin-top: 5px; }
.head-actions { display: flex; gap: 9px; flex-wrap: wrap; }

/* ---------- buttons & inputs ---------- */
.btn {
  font-family: var(--sans); font-weight: 600; font-size: 13px;
  padding: 9px 16px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line2); background: var(--panel2); color: var(--text);
  transition: all .15s; display: inline-flex; align-items: center; gap: 7px;
}
.btn:hover { border-color: var(--dim); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #11150a; }
.btn-accent:hover { background: #d6fa62; border-color: #d6fa62; }
.btn-danger { background: var(--red-dim); border-color: rgba(255,77,109,.3); color: var(--red); }
.btn-danger:hover { border-color: var(--red); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 11px; font-size: 12px; border-radius: 7px; }
.btn-block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .45; pointer-events: none; }

input[type=text], input[type=url], input[type=number], select, textarea {
  font-family: var(--sans); font-size: 13.5px;
  background: var(--bg2); color: var(--text);
  border: 1px solid var(--line2); border-radius: 8px;
  padding: 9px 12px; width: 100%;
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { font-family: var(--mono); font-size: 12.5px; resize: vertical; }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 12px; font-weight: 600; color: var(--mut); margin-bottom: 6px; letter-spacing: .3px; }
label.field small { display: block; color: var(--dim); font-size: 11.5px; margin-top: 5px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- cards / stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: 18px 20px; position: relative; overflow: hidden;
}
.stat::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--line2); }
.stat.s-accent::before { background: var(--accent); }
.stat.s-red::before { background: var(--red); }
.stat.s-green::before { background: var(--green); }
.stat.s-amber::before { background: var(--amber); }
.stat .num { font-size: 30px; font-weight: 800; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.stat .lbl { font-family: var(--mono); font-size: 10px; letter-spacing: 1.8px; text-transform: uppercase; color: var(--dim); margin-top: 5px; }
.stat.s-red .num { color: var(--red); }
.stat.s-green .num { color: var(--green); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.panel + .panel { margin-top: 18px; }
.panel-head {
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.panel-head h2 { font-size: 14px; font-weight: 700; letter-spacing: .2px; }
.panel-body { padding: 18px; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; }
th {
  font-family: var(--mono); font-size: 10px; letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--dim); text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--line);
  font-weight: 500;
}
td { padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 13.5px; vertical-align: middle; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: rgba(255,255,255,.018); }
tbody tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
.td-mono { font-family: var(--mono); font-size: 12px; color: var(--mut); }
.td-num { font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12.5px; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .8px;
  padding: 3px 9px; border-radius: 99px; text-transform: uppercase;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-passed, .b-complete, .b-approved { background: var(--green-dim); color: var(--green); }
.b-changed { background: var(--red-dim); color: var(--red); }
.b-failed { background: var(--amber-dim); color: var(--amber); }
.b-baseline { background: rgba(90,162,255,.1); color: var(--blue); }
.b-running { background: var(--accent-dim); color: var(--accent); }
.b-running::before { animation: pulse 1.2s infinite; }
.b-grp { background: var(--panel2); color: var(--mut); border: 1px solid var(--line2); }
.b-grp::before { display: none; }
.b-disabled { background: var(--panel2); color: var(--dim); }

.diffpct { font-family: var(--mono); font-weight: 600; font-size: 13px; }
.diffpct.hi { color: var(--red); }
.diffpct.md { color: var(--amber); }
.diffpct.lo { color: var(--green); }

/* ---------- site grid ---------- */
.toolbar { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; align-items: center; }
.toolbar input[type=text] { max-width: 280px; }
.toolbar select { width: auto; }
.chip-row { display: flex; gap: 6px; }
.chip {
  font-family: var(--mono); font-size: 11px; padding: 6px 13px; border-radius: 99px;
  border: 1px solid var(--line2); background: transparent; color: var(--mut); cursor: pointer;
  transition: all .15s; font-weight: 600;
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #11150a; }

.empty {
  text-align: center; padding: 60px 20px; color: var(--dim);
}
.empty .big { font-size: 38px; margin-bottom: 12px; opacity: .5; }
.empty p { font-size: 13.5px; max-width: 420px; margin: 0 auto 18px; line-height: 1.6; }

/* ---------- review cards ---------- */
.review-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.rev-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden; cursor: pointer; transition: all .18s;
}
.rev-card:hover { border-color: var(--red); transform: translateY(-2px); box-shadow: 0 8px 28px rgba(0,0,0,.4); }
.rev-thumb { height: 170px; background: #0a0c10; position: relative; overflow: hidden; }
.rev-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.rev-thumb .pct {
  position: absolute; top: 10px; right: 10px;
  background: var(--red); color: #fff; font-family: var(--mono);
  font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px;
}
.rev-meta { padding: 13px 15px; }
.rev-meta .site { font-weight: 700; font-size: 14px; }
.rev-meta .path { font-family: var(--mono); font-size: 11.5px; color: var(--mut); margin-top: 3px; }

/* ---------- compare viewer ---------- */
.cmp-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.cmp-title .site { font-size: 19px; font-weight: 800; }
.cmp-title .path { font-family: var(--mono); font-size: 12px; color: var(--mut); margin-top: 3px; }
.cmp-tabs { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 4px; }
.cmp-tabs button {
  font-family: var(--sans); font-weight: 600; font-size: 12.5px;
  padding: 7px 16px; border-radius: 6px; border: none; cursor: pointer;
  background: transparent; color: var(--mut); transition: all .14s;
}
.cmp-tabs button.active { background: var(--panel2); color: var(--accent); }
.cmp-stage {
  background: #07090d; border: 1px solid var(--line); border-radius: var(--r);
  overflow: auto; max-height: calc(100vh - 230px); position: relative;
}
.cmp-stage img { display: block; width: 100%; }
.cmp-sbs { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); }
.cmp-sbs > div { background: #07090d; overflow: hidden; }
.cmp-sbs .tag {
  position: sticky; top: 0; z-index: 2;
  font-family: var(--mono); font-size: 10px; letter-spacing: 1.6px;
  padding: 7px 12px; background: rgba(10,13,18,.92); backdrop-filter: blur(4px);
  color: var(--mut); border-bottom: 1px solid var(--line);
}
/* slider mode */
.cmp-slider { position: relative; overflow: hidden; cursor: ew-resize; }
.cmp-slider img { width: 100%; display: block; user-select: none; pointer-events: none; }
.cmp-slider .top-img { position: absolute; inset: 0; overflow: hidden; }
.cmp-slider .divider {
  position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent);
  box-shadow: 0 0 12px rgba(200,240,74,.7); z-index: 3;
}
.cmp-slider .divider::after {
  content: '⟷'; position: absolute; top: 24px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: #11150a; width: 30px; height: 30px;
  border-radius: 50%; display: grid; place-items: center; font-size: 14px; font-weight: 700;
}

/* ---------- modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(4,6,10,.75); backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 100; padding: 24px;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--panel); border: 1px solid var(--line2); border-radius: 14px;
  width: 100%; max-width: 560px; max-height: 88vh; overflow: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
  animation: modalIn .22s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.modal-head { padding: 18px 22px 0; display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { font-size: 17px; font-weight: 800; }
.modal-close { background: none; border: none; color: var(--dim); font-size: 22px; cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 18px 22px 22px; }
.modal-foot { padding: 0 22px 22px; display: flex; justify-content: flex-end; gap: 9px; }

/* ---------- toasts ---------- */
.toast-wrap { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 9px; }
.toast {
  background: var(--panel2); border: 1px solid var(--line2); border-left: 3px solid var(--accent);
  border-radius: 9px; padding: 12px 18px; font-size: 13px; min-width: 240px;
  box-shadow: 0 10px 32px rgba(0,0,0,.5);
  animation: toastIn .25s cubic-bezier(.2,.9,.3,1.2);
}
.toast.err { border-left-color: var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } }

/* ---------- pages list inside site detail ---------- */
.crumb { font-family: var(--mono); font-size: 11.5px; color: var(--dim); margin-bottom: 8px; }
.crumb a { color: var(--mut); text-decoration: none; }
.crumb a:hover { color: var(--accent); }

.switch { position: relative; width: 36px; height: 20px; display: inline-block; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .sl {
  position: absolute; inset: 0; background: var(--line2); border-radius: 99px;
  cursor: pointer; transition: .2s;
}
.switch .sl::before {
  content: ''; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  background: var(--mut); top: 3px; left: 3px; transition: .2s;
}
.switch input:checked + .sl { background: var(--accent); }
.switch input:checked + .sl::before { background: #11150a; transform: translateX(16px); }

@media (max-width: 900px) {
  .sidebar { width: 64px; }
  .brand-text, .nav a span:not(.nav-badge), .runbox { display: none; }
  .nav a { justify-content: center; padding: 11px; }
  .nav a i { width: auto; }
  .main { padding: 20px 16px 50px; }
  .cmp-sbs { grid-template-columns: 1fr; }
}
