:root {
  color-scheme: dark;
  --bg: #0b111c;
  --panel: #121d2d;
  --line: #253349;
  --text: #edf3ff;
  --muted: #94a5bd;
  --blue: #3689ff;
  --green: #57dab0;
  --red: #ff8893;
  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  outline-offset: 4px;
}
button,
a {
  touch-action: manipulation;
}
button {
  border: 1px solid var(--line);
  background: #19283e;
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  min-height: 42px;
}
button:hover {
  border-color: var(--blue);
  background: #203754;
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
button.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}
button.danger {
  color: var(--red);
}
a {
  color: #83baff;
  text-decoration: none;
}
h1 {
  font-size: 27px;
  margin: 0 0 7px;
  letter-spacing: -0.8px;
}
h2 {
  font-size: 17px;
  margin: 0;
}
h3 {
  font-size: 15px;
  margin: 0 0 8px;
}
p {
  line-height: 1.6;
}
small,
.muted {
  color: var(--muted);
}
.shell {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  min-height: 100dvh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  border-right: 1px solid var(--line);
  padding: 28px 16px;
  background: #0e1725;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.brand {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.3;
}
.brand span {
  color: var(--blue);
}
.brand small {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: #90a8c9;
  margin-top: 7px;
}
.nav {
  display: grid;
  gap: 7px;
}
.nav button {
  display: flex;
  gap: 12px;
  align-items: center;
  text-align: left;
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  padding: 12px;
}
.nav button.active {
  background: #1a3354;
  color: #83baff;
  border: 1px solid #254b79;
}
.nav svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
}
.side-bottom {
  margin-top: auto;
  font-size: 12px;
  color: var(--muted);
  display: grid;
  gap: 12px;
}
.main {
  min-width: 0;
  padding: 26px 30px 45px;
  max-width: 1600px;
  width: 100%;
  margin: auto;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 24px;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-size: 10px;
  color: #8ea6c7;
  font-weight: 700;
  margin-bottom: 10px;
}
.company {
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  border: 1px solid #325078;
  background: #163052;
  color: #89baff;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-weight: 700;
}
.notice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border: 1px solid #69592f;
  background: #272416;
  border-radius: 9px;
  color: #f1d78c;
  margin-bottom: 22px;
  font-size: 12px;
  line-height: 1.5;
}
.notice.info {
  border-color: #244b75;
  background: #132940;
  color: #9fc8ff;
}
.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat {
  background: var(--panel);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.stat strong {
  display: block;
  font-size: 30px;
  letter-spacing: -1px;
  margin: 10px 0 4px;
}
.stat .tag {
  font-size: 10px;
  color: var(--muted);
}
.stat svg {
  float: right;
  width: 19px;
  height: 19px;
  color: #6485af;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 20px;
  overflow: hidden;
}
.panel-head {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.panel-body {
  padding: 20px;
}
.split {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr);
  gap: 20px;
}
.toolbar {
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.toolbar input {
  min-width: 170px;
  flex: 1;
}
.toolbar select {
  max-width: 220px;
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid #32425a;
  background: #0c1625;
  color: var(--text);
  border-radius: 7px;
  padding: 11px;
  min-height: 42px;
}
textarea {
  resize: vertical;
  min-height: 90px;
}
label {
  display: grid;
  gap: 7px;
  font-size: 12px;
  color: #bbc9dc;
}
label.check {
  display: flex;
  align-items: center;
  gap: 10px;
}
input[type="checkbox"] {
  width: 17px;
  min-height: 17px;
  flex-shrink: 0;
}
select[multiple] {
  min-height: 100px;
}
select option {
  padding: 5px;
}
.forms {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.wide {
  grid-column: 1/-1;
}
.actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 22px;
}
.empty {
  padding: 45px 20px;
  text-align: center;
  color: var(--muted);
  line-height: 1.7;
}
.empty svg {
  width: 38px;
  height: 38px;
  display: block;
  margin: 0 auto 14px;
  color: #557399;
}
.table-wrap {
  overflow-x: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  text-align: left;
  font-size: 12px;
}
th {
  text-transform: uppercase;
  letter-spacing: 0.7px;
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  padding: 13px 16px;
  background: #111b2b;
}
td {
  padding: 14px 16px;
  border-top: 1px solid #223147;
  vertical-align: middle;
}
td strong {
  font-weight: 600;
}
td small {
  display: block;
  margin-top: 4px;
}
tr:hover {
  background: #16243a;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 10px;
  background: #25344c;
  color: #bbcce6;
  white-space: nowrap;
}
.badge.allow,
.badge.active {
  background: #113d35;
  color: #7ce5be;
}
.badge.deny,
.badge.inactive,
.badge.revoked,
.badge.suspended {
  background: #42262e;
  color: #ff9ca6;
}
.badge.review {
  background: #40371f;
  color: #e6c476;
}
.plate {
  font-family: ui-monospace, monospace;
  font-size: 14px;
  letter-spacing: 1px;
  color: #fff;
}
.links {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}
.links button {
  padding: 6px 10px;
  min-height: 34px;
  font-size: 12px;
}
.health-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.health-row:last-child {
  border: 0;
}
.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 7px;
}
.dot.warn {
  background: #e9bc5f;
}
.cameras {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.camera {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #070c13;
}
.camera-frame {
  position: relative;
  aspect-ratio: 16/9;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.camera-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  position: absolute;
  inset: 0;
}
.camera-frame span {
  padding: 15px;
  text-align: center;
}
.camera-head {
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.camera-meta {
  padding: 14px;
  background: var(--panel);
  font-size: 12px;
}
.camera-meta p {
  margin: 6px 0;
}
.camera-meta button {
  margin-top: 8px;
  width: 100%;
}
.tabs {
  display: flex;
  gap: 6px;
  overflow: auto;
  margin-bottom: 18px;
  padding-bottom: 4px;
}
.tabs button {
  flex-shrink: 0;
  font-size: 12px;
}
.tabs button.selected {
  border-color: var(--blue);
  color: #96c5ff;
  background: #173253;
}
.week-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
}
.week-row input {
  font-family: ui-monospace, monospace;
  font-size: 12px;
}
.caption {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}
.evidence {
  max-width: 100%;
  max-height: 52dvh;
  border-radius: 8px;
  object-fit: contain;
}
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 25px;
  background: radial-gradient(ellipse at 20% 0, #16304f, transparent 70%);
}
.login-box {
  max-width: 420px;
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px;
}
.login-box h1 {
  font-size: 22px;
  margin: 30px 0 12px;
}
.login-box label {
  margin-top: 16px;
}
.login-box button {
  width: 100%;
  margin-top: 22px;
}
.error {
  color: #ff9aa4;
  line-height: 1.6;
}
.loading {
  padding: 40px;
  color: var(--muted);
}
dialog {
  color: var(--text);
  background: var(--panel);
  border: 1px solid #394e6d;
  border-radius: 12px;
  padding: 0;
  width: min(760px, calc(100vw - 24px));
  max-height: 90dvh;
  overflow: auto;
}
dialog::backdrop {
  background: #02070cc9;
  backdrop-filter: blur(3px);
}
dialog .panel-head {
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 1;
}
.close {
  font-size: 21px;
  padding: 2px 12px;
}
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 20px;
  border: 1px solid #406a99;
  border-radius: 9px;
  background: #1c3454;
  z-index: 99;
  max-width: 90vw;
  display: none;
  box-shadow: 0 8px 40px #0008;
}
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-top: 1px solid var(--line);
}
code {
  word-break: break-all;
}
.mobile-company {
  display: none;
}
@media (min-width: 1300px) {
  .main {
    padding: 32px 42px;
  }
}
@media (max-width: 1000px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .split {
    grid-template-columns: 1fr;
  }
  .sidebar {
    width: 190px;
  }
  .shell {
    grid-template-columns: 190px minmax(0, 1fr);
  }
  .main {
    padding: 22px;
  }
  .cameras {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 700px) {
  .shell {
    display: block;
  }
  .sidebar {
    height: auto;
    width: auto;
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 5px 4px calc(5px + env(safe-area-inset-bottom));
    border: 0;
    border-top: 1px solid var(--line);
    z-index: 5;
    display: block;
  }
  .sidebar > .brand,
  .side-bottom {
    display: none;
  }
  .nav {
    display: flex;
    gap: 0;
    justify-content: space-around;
  }
  .nav button {
    padding: 8px 2px;
    border-radius: 5px;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 5px;
    font-size: 8px;
    line-height: 1.3;
  }
  .nav svg {
    width: 18px;
    height: 18px;
  }
  .main {
    padding: calc(20px + env(safe-area-inset-top)) 14px
      calc(100px + env(safe-area-inset-bottom));
  }
  .topbar {
    padding-bottom: 20px;
    gap: 8px;
  }
  h1 {
    font-size: 23px;
  }
  .company .company-label {
    display: none;
  }
  .eyebrow {
    font-size: 9px;
    letter-spacing: 1px;
  }
  .grid {
    gap: 10px;
    margin-bottom: 16px;
  }
  .stat {
    padding: 14px;
  }
  .stat strong {
    font-size: 25px;
  }
  .stat small {
    font-size: 11px;
  }
  .notice {
    font-size: 11px;
    padding: 11px;
    gap: 8px;
    margin-bottom: 16px;
  }
  .panel-head {
    padding: 14px;
  }
  .panel-body {
    padding: 14px;
  }
  .forms {
    grid-template-columns: 1fr;
  }
  .wide {
    grid-column: auto;
  }
  .toolbar input {
    min-width: 120px;
  }
  .toolbar select {
    max-width: none;
    flex: 1;
    min-width: 120px;
  }
  th,
  td {
    padding: 11px 12px;
  }
  .week-row {
    grid-template-columns: 65px 1fr;
  }
  .avatar {
    width: 31px;
    height: 31px;
    font-size: 11px;
  }
  .mobile-company {
    display: block;
  }
  .table-wrap table {
    min-width: 520px;
  }
  .events-cards {
    display: grid;
    gap: 9px;
    padding: 12px;
  }
  .event-card {
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #101c2c;
    cursor: pointer;
  }
  .event-top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
  }
  .event-card small {
    display: block;
    margin-top: 7px;
  }
  .desktop-events {
    display: none;
  }
  #toast {
    bottom: 90px;
    font-size: 12px;
  }
  .login-box {
    padding: 24px;
  }
  .company select {
    max-width: 125px;
  }
}
@media (min-width: 701px) {
  .events-cards {
    display: none;
  }
}
.sidebar {
  overflow-y: auto;
  overscroll-behavior: contain;
}
@media (max-height: 500px) and (min-width: 701px) {
  .sidebar {
    padding: 10px;
    gap: 10px;
  }
  .sidebar .brand {
    font-size: 18px;
  }
  .sidebar .brand small,
  .sidebar .side-bottom {
    display: none;
  }
  .nav {
    gap: 1px;
  }
  .nav button {
    padding: 5px 8px;
    min-height: 30px;
    font-size: 12px;
  }
}

html.embedded .sidebar,
html.embedded .topbar,
html.embedded .main > .notice {
  display: none !important;
}
html.embedded .shell {
  display: block;
  min-height: 0;
}
html.embedded .main {
  padding: 0 !important;
  max-width: none;
  margin: 0;
}
html.embedded body {
  margin: 0;
  min-height: 0;
}
html.embedded #toast {
  bottom: 15px;
}

html.embedded .login {
  min-height: 400px;
}
html.embedded[data-view="settings"] #content > .tabs {
  display: none;
}
