:root {
  --bg: #040406;
  --bg-2: #09090d;
  --panel: rgba(13, 14, 18, .92);
  --panel-2: rgba(20, 21, 26, .96);
  --line: rgba(255, 59, 72, .24);
  --line-soft: rgba(255, 255, 255, .06);
  --text: #f5f7fb;
  --muted: #a6aab4;
  --red: #d92638;
  --red-2: #ff5666;
  --red-glow: rgba(217, 38, 56, .24);
  --gold: #ffcc4d;
  --green: #20c997;
  --amber: #ffb020;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 18% -10%, rgba(217, 38, 56, .22), transparent 28%),
    radial-gradient(circle at 82% 10%, rgba(255, 59, 72, .12), transparent 22%),
    radial-gradient(circle at 50% 100%, rgba(255, 204, 77, .08), transparent 28%),
    linear-gradient(180deg, #0b0b10 0%, var(--bg) 40%, #020203 100%);
  color: var(--text);
  font: 14px "Inter", "Segoe UI", "Helvetica Neue", sans-serif;
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, rgba(255,255,255,.03), transparent 35%),
    linear-gradient(300deg, rgba(255,255,255,.02), transparent 35%);
  mix-blend-mode: screen;
  opacity: .55;
}

header.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(18px);
  background: linear-gradient(180deg, rgba(8, 8, 12, .92), rgba(8, 8, 12, .74));
  border-bottom: 1px solid rgba(255, 59, 72, .18);
  padding: 18px 5vw;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .35);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand-logos {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.logo-tile {
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02)),
    linear-gradient(180deg, rgba(217, 38, 56, .16), rgba(0, 0, 0, .12));
  border: 1px solid rgba(255, 59, 72, .24);
  box-shadow:
    0 0 0 1px rgba(255,255,255,.04) inset,
    0 10px 30px rgba(0, 0, 0, .35),
    0 0 28px rgba(217, 38, 56, .2);
  position: relative;
  overflow: hidden;
}

.logo-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.13), transparent 35%);
  pointer-events: none;
}

.logo-tile img {
  width: 88%;
  height: 88%;
  object-fit: contain;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .45));
}

.brand-copy {
  min-width: 0;
}

.brand-copy small,
.title span,
p,
.hint,
.status-note {
  color: var(--muted);
}

.camera-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 16px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: rgba(217, 38, 56, .12);
  border: 1px solid rgba(255, 59, 72, .42);
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(217, 38, 56, .12);
}

.camera-picker select {
  min-width: 330px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 59, 72, .28);
  border-radius: 8px;
  background: #15161c;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.brand-copy small {
  display: block;
  letter-spacing: .22em;
  text-transform: uppercase;
  font-size: 11px;
  color: #ff808b;
}

h1 {
  font-size: 26px;
  margin: 4px 0 6px;
  letter-spacing: -.03em;
}

h2 {
  font-size: 16px;
  margin: 0 0 16px;
  letter-spacing: .02em;
}

.brand-copy p {
  margin: 0;
  max-width: 740px;
}

.command-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #f7f7fb;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  box-shadow: 0 0 0 1px rgba(255,255,255,.02) inset;
}

.chip.live {
  background: linear-gradient(180deg, rgba(255, 86, 102, .24), rgba(217, 38, 56, .16));
  border-color: rgba(255, 86, 102, .35);
  box-shadow: 0 0 18px rgba(217, 38, 56, .28);
  position: relative;
  padding-left: 12px;
}

.chip.live::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #ff6775;
  box-shadow: 0 0 12px #ff6775;
}

.status-stack {
  display: grid;
  gap: 10px;
  justify-items: end;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.settings-button,
.settings-close {
  width: auto;
  padding: 8px 14px;
  border: 1px solid rgba(255, 86, 102, .34);
  background: rgba(217, 38, 56, .14);
  box-shadow: none;
}

.settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 29;
  background: rgba(0, 0, 0, .66);
  backdrop-filter: blur(5px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}

.settings-panel {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 30;
  width: min(440px, 94vw);
  height: 100dvh;
  overflow-y: auto;
  padding: 22px;
  background:
    radial-gradient(circle at 100% 0, rgba(217, 38, 56, .2), transparent 36%),
    #08090d;
  border-left: 1px solid rgba(255, 86, 102, .3);
  box-shadow: -24px 0 70px rgba(0, 0, 0, .58);
  transform: translateX(105%);
  transition: transform .24s ease;
}

body.settings-open { overflow: hidden; }
body.settings-open .settings-backdrop { opacity: 1; pointer-events: auto; }
body.settings-open .settings-panel { transform: translateX(0); }

.settings-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.settings-panel__head small {
  color: #ff808b;
  font-size: 10px;
  letter-spacing: .18em;
}

.settings-panel__head h2 { margin: 5px 0 0; font-size: 24px; }

.settings-section {
  padding: 18px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.settings-section h3 { margin: 0 0 12px; font-size: 15px; }

.roi-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

main {
  max-width: 1500px;
  margin: 22px auto 28px;
  padding: 0 24px;
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(320px, .95fr);
  gap: 18px;
}

.card {
  background:
    linear-gradient(180deg, rgba(255,255,255,.04), transparent 18%),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  box-shadow:
    0 18px 40px rgba(0, 0, 0, .35),
    0 0 0 1px rgba(255,255,255,.03) inset;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 180px;
  height: 2px;
  background: linear-gradient(90deg, var(--red), transparent);
  opacity: .9;
}

.live img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: contain;
  background: #020204;
  border-radius: 14px;
  border: 1px solid rgba(255, 59, 72, .18);
  box-shadow: 0 0 0 1px rgba(255,255,255,.03) inset;
  position: relative;
  z-index: 2;
}

.stream-frame {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  margin-top: 2px;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 59, 72, .12), transparent 56%),
    linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01)),
    #020204;
  border: 1px solid rgba(255, 59, 72, .26);
  box-shadow:
    0 0 0 1px rgba(255,255,255,.03) inset,
    0 0 0 1px rgba(255, 59, 72, .08),
    0 0 30px rgba(217, 38, 56, .32),
    0 0 90px rgba(217, 38, 56, .12);
}

.stream-frame img {
  display: block;
  width: 100%;
}

.stream-frame__roi {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
  pointer-events: none;
}

.stream-frame__roi.editing {
  pointer-events: auto;
  cursor: crosshair;
}

.stream-frame__glow,
.stream-frame__scan {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.stream-frame__glow {
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 86, 102, .18), transparent 44%),
    radial-gradient(circle at 0 0, rgba(255, 204, 77, .08), transparent 28%);
  mix-blend-mode: screen;
  opacity: .88;
}

.stream-frame__scan {
  background: linear-gradient(180deg, transparent, rgba(255, 86, 102, .10), transparent);
  height: 24%;
  top: -24%;
  animation: scanline 5.5s linear infinite;
  opacity: .65;
}

.stream-frame__badge {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 3;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  background: rgba(0, 0, 0, .68);
  color: #ffd7db;
  border: 1px solid rgba(255, 86, 102, .34);
  box-shadow: 0 0 22px rgba(217, 38, 56, .25);
}

.title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.pill {
  padding: 8px 13px;
  border-radius: 99px;
  background: rgba(217, 38, 56, .14);
  border: 1px solid rgba(255, 59, 72, .24);
  color: #ffd7db;
  box-shadow: 0 0 0 1px rgba(255,255,255,.03) inset;
}

.pill.online {
  background: rgba(32, 201, 151, .12);
  color: #88ffd6;
  border-color: rgba(32, 201, 151, .24);
}

.last {
  margin-top: 10px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.015)), #0a0a0d;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.05);
}

.dashboard-side {
  display: grid;
  gap: 18px;
  align-content: start;
  position: sticky;
  top: 116px;
}

input, textarea {
  width: 100%;
  padding: 11px;
  margin: 0 0 10px;
  color: white;
  background: rgba(5, 6, 8, .9);
  border: 1px solid rgba(255, 59, 72, .16);
  border-radius: 8px;
  outline: none;
}

input:focus, textarea:focus {
  border-color: rgba(255, 86, 102, .72);
  box-shadow: 0 0 0 4px rgba(217, 38, 56, .15);
}

textarea { min-height: 70px; }

.field {
  display: block;
  margin-bottom: 10px;
}

.field span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

button, .upload {
  display: block;
  width: 100%;
  padding: 11px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--red-2), var(--red));
  color: #fff;
  font-weight: 650;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(217, 38, 56, .24);
}

.upload {
  background: rgba(255,255,255,.03);
  border: 1px dashed rgba(255, 86, 102, .44);
  margin-bottom: 10px;
}

.upload input { margin: 8px 0 0; }

.secondary {
  width: auto;
  padding: 8px 12px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: none;
}

.secondary:hover,
button:hover,
.upload:hover {
  transform: translateY(-1px);
}

.wide { grid-column: 1 / -1; }
.events, .persons { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.event-search { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)) auto; gap: 10px; align-items: end; margin: 12px 0 16px; padding: 12px; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; background: rgba(255,255,255,.04); }
.event-search label { display: grid; gap: 5px; font-size: .78rem; font-weight: 700; color: #d9dce5; }
.event-search input { min-width: 0; }
.event-search__actions { display: flex; gap: 8px; }
@media (max-width: 900px) { .event-search { grid-template-columns: repeat(2, minmax(150px, 1fr)); } }
@media (max-width: 560px) { .event-search { grid-template-columns: 1fr; } .event-search__actions { justify-content: stretch; } .event-search__actions button { flex: 1; } }
.item {
  background: linear-gradient(180deg, rgba(255,255,255,.03), transparent 16%), #0a0b10;
  border: 1px solid rgba(255, 59, 72, .18);
  border-radius: 10px;
  padding: 12px;
}

.item strong { font-size: 16px; }
.score { color: var(--amber); }
.analysis {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(18, 12, 16, .88);
  color: #d7e7fb;
  line-height: 1.35;
}

.analysis.error { background: rgba(95, 17, 28, .82); color: #ffc0c8; }
.analysis.ktp { background: rgba(16, 21, 34, .9); color: #d7efff; }
.analysis.ktp strong { display: block; margin-bottom: 4px; color: #7dd3ff; }

.match-results {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.match-item {
  background: #0a0b10;
  border: 1px solid rgba(255, 59, 72, .18);
  border-radius: 12px;
  padding: 12px;
}

.match-item.hit {
  border-color: rgba(255, 204, 77, .45);
  box-shadow: 0 0 0 1px rgba(255, 204, 77, .16) inset;
}

.match-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.match-score {
  color: #ffd26b;
  font-weight: 700;
}

.match-summary {
  margin-top: 6px;
  color: #d7e7fb;
  line-height: 1.35;
}

.match-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.actions { display: flex; gap: 6px; margin-top: 9px; }
.actions button { padding: 7px; font-size: 12px; }
.danger { background: #9f3541; }
.hint { margin: 8px 0 0; font-size: 12px; }
.access-message {
  margin: 10px 0 0;
  padding: 9px 10px;
  border: 1px solid rgba(255, 204, 77, .3);
  border-radius: 8px;
  background: rgba(255, 204, 77, .07);
  color: #ffd77b;
  font-size: 12px;
  line-height: 1.4;
}
.access-message.ok {
  border-color: rgba(67, 211, 137, .3);
  background: rgba(67, 211, 137, .07);
  color: #8ae8b6;
}
.access-message.error {
  border-color: rgba(255, 86, 102, .36);
  background: rgba(255, 86, 102, .08);
  color: #ff9aa5;
}
.locked-data {
  padding: 14px;
  border: 1px dashed rgba(255, 204, 77, .28);
  border-radius: 10px;
  color: #ffd77b;
  background: rgba(255, 204, 77, .04);
}
.thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(255, 59, 72, .16);
  background: #07080c;
  margin-bottom: 10px;
}

.counter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.counter-card {
  background:
    radial-gradient(circle at 85% 10%, rgba(217, 38, 56, .22), transparent 42%),
    linear-gradient(145deg, rgba(22, 23, 29, .98), rgba(7, 8, 11, .98));
}

.latest-card {
  background:
    radial-gradient(circle at 90% 5%, rgba(255, 204, 77, .12), transparent 36%),
    linear-gradient(145deg, rgba(20, 21, 27, .98), rgba(7, 8, 11, .98));
}

.latest-face {
  display: grid;
  grid-template-columns: minmax(110px, .85fr) minmax(0, 1.15fr);
  gap: 12px;
}

.latest-face__image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid rgba(255, 86, 102, .28);
  border-radius: 12px;
  background: #040507;
}

.latest-face__body { min-width: 0; }
.latest-face__body strong { display: block; margin: 8px 0 5px; font-size: 18px; }

.latest-face__status {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: .05em;
}

.latest-face__status.found { background: rgba(32, 201, 151, .13); color: #88ffd6; }
.latest-face__status.missing { background: rgba(255, 176, 32, .13); color: #ffd078; }
.latest-face__meta { color: var(--muted); font-size: 11px; line-height: 1.45; }
.latest-face__score { margin-top: 6px; color: var(--gold); font-weight: 700; }
.latest-analysis { margin-top: 8px; font-size: 12px; line-height: 1.4; color: #d7e7fb; }
.latest-analysis.muted { color: var(--muted); }

.counter-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.counter-heading small {
  display: block;
  margin-bottom: 5px;
  color: #ff808b;
  font-size: 10px;
  letter-spacing: .16em;
}

.counter-heading h2 { margin: 0; font-size: 20px; }

.counter-live {
  padding: 6px 9px;
  border: 1px solid rgba(255, 86, 102, .4);
  border-radius: 999px;
  background: rgba(217, 38, 56, .15);
  color: #ff9aa5;
  font-size: 10px;
  letter-spacing: .15em;
  box-shadow: 0 0 18px rgba(217, 38, 56, .24);
}

.counter-grid div, .profile-item {
  background: #0a0b10;
  border: 1px solid rgba(255, 59, 72, .16);
  border-radius: 10px;
  padding: 12px;
}

.counter-grid strong {
  display: block;
  font-size: 22px;
  line-height: 1.1;
}

.counter-card .counter-grid div:nth-child(-n+2) strong {
  font-size: clamp(34px, 4vw, 56px);
  color: #fff;
}

.counter-card .counter-grid div:first-child {
  border-color: rgba(32, 201, 151, .3);
  box-shadow: 0 0 22px rgba(32, 201, 151, .08) inset;
}

.counter-card .counter-grid div:nth-child(2) {
  border-color: rgba(255, 86, 102, .34);
  box-shadow: 0 0 22px rgba(217, 38, 56, .1) inset;
}

.counter-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.profiles { display: grid; gap: 10px; }
.profile-item strong { display: block; margin-bottom: 4px; }
.profile-item small { display: block; margin-bottom: 8px; }

.enroll-preview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin: 0 0 10px;
}

.enroll-preview:empty { display: none; }

.enroll-preview img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid rgba(255, 86, 102, .3);
  border-radius: 8px;
  background: #06070a;
}

.status-note {
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 8px 12px;
  border: 1px solid rgba(255, 59, 72, .16);
  border-radius: 999px;
  background: rgba(255,255,255,.03);
}

.card:hover {
  border-color: rgba(255, 86, 102, .34);
  box-shadow:
    0 20px 44px rgba(0, 0, 0, .44),
    0 0 0 1px rgba(255,255,255,.03) inset,
    0 0 30px rgba(217, 38, 56, .08);
}

@keyframes scanline {
  0% { transform: translateY(0); }
  100% { transform: translateY(560%); }
}

@media (max-width: 850px) {
  main { grid-template-columns: 1fr; padding: 0 14px; }
  .wide { grid-column: auto; }
  header.topbar {
    padding: 14px;
    align-items: flex-start;
    flex-direction: column;
  }
  .brand-block {
    width: 100%;
    align-items: flex-start;
  }
  .status-stack {
    width: 100%;
    justify-items: start;
  }
  .header-actions { width: 100%; justify-content: space-between; }
  .status-note {
    width: 100%;
    text-align: center;
  }
  .dashboard-side {
    position: static;
    top: auto;
  }
  .latest-face { grid-template-columns: 120px minmax(0, 1fr); }
  .brand-logos {
    flex-direction: column;
  }
  .logo-tile {
    width: 64px;
    height: 64px;
    border-radius: 16px;
  }
  .command-strip {
    gap: 6px;
  }
  h1 { font-size: 18px; }
  .title { align-items: flex-start; flex-direction: column; }
  .stream-frame__badge {
    top: 10px;
    left: 10px;
    font-size: 10px;
    letter-spacing: .14em;
  }
}
.event-pagination { display:flex; justify-content:center; align-items:center; gap:12px; margin:18px 0 6px; } .event-pagination button:disabled { opacity:.45; cursor:not-allowed; } .event-pagination span { font-weight:700; }
