:root {
  color-scheme: light;
  --ink-950: #08111f;
  --ink-900: #0b1628;
  --ink-800: #16243a;
  --ink-700: #293952;
  --slate-600: #5d6b80;
  --slate-500: #768398;
  --slate-300: #cbd4df;
  --slate-200: #e2e8f0;
  --slate-100: #edf2f7;
  --canvas: #f5f7fb;
  --surface: #ffffff;
  --green: #0b8b6f;
  --green-bright: #36d6a5;
  --green-soft: #e3f7f0;
  --blue: #4169e1;
  --violet: #7357d8;
  --amber: #c47913;
  --red: #b83b4b;
  --shadow: 0 18px 45px rgba(21, 35, 55, 0.08);
  --radius-lg: 1.25rem;
  --radius-md: 0.875rem;
  font-family: Inter, "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink-900);
  background: var(--canvas);
  font-size: 1rem;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(65, 105, 225, 0.35);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 15.5rem minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.25rem;
  color: #eaf0f7;
  background:
    radial-gradient(circle at 18% 8%, rgba(54, 214, 165, 0.15), transparent 30%),
    linear-gradient(160deg, var(--ink-900), var(--ink-950));
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 2.8rem;
  height: 2.8rem;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.9rem;
  color: var(--ink-950);
  background: var(--green-bright);
  font-size: 0.88rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  box-shadow: 0 10px 28px rgba(54, 214, 165, 0.24);
}

.brand-copy {
  display: grid;
  line-height: 1.15;
}

.brand-copy strong {
  font-size: 1.05rem;
  letter-spacing: -0.015em;
}

.brand-copy small,
.sidebar-foot small {
  margin-top: 0.24rem;
  color: #91a0b6;
  font-size: 0.78rem;
}

.primary-nav {
  margin-top: 2.8rem;
  display: grid;
  gap: 0.35rem;
}

.mobile-menu-toggle {
  display: none;
}

.mobile-nav-heading {
  display: none;
}

.account-menu {
  margin-top: 1rem;
  padding: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.04);
}

.account-menu[hidden] {
  display: none;
}

.account-avatar {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 0.65rem;
  color: var(--ink-950);
  background: var(--green-bright);
  font-size: 0.7rem;
  font-weight: 900;
}

.account-menu > span:last-child {
  min-width: 0;
  display: grid;
}

.account-menu strong,
.account-menu small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu strong {
  color: #f8fbff;
  font-size: 0.78rem;
}

.account-menu small {
  color: #91a0b6;
  font-size: 0.68rem;
}

.logout-button {
  margin-top: 0.35rem;
  color: #ffc6cc;
  background: rgba(255, 112, 126, 0.07) !important;
}

.nav-group {
  min-width: 0;
}

.nav-group[hidden],
.nav-tree[hidden] {
  display: none;
}

.back-link {
  display: inline-flex;
  margin-bottom: 0.75rem;
  color: var(--blue);
  font-size: 0.82rem;
  font-weight: 750;
  text-decoration: none;
}

.back-link[hidden],
.nav-item[hidden] {
  display: none;
}

.install-app {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 2.7rem;
  margin-top: 0.75rem;
  padding: 0 0.85rem;
  border: 1px solid rgba(54, 214, 165, 0.24);
  border-radius: 0.8rem;
  color: #d9fff3;
  background: rgba(54, 214, 165, 0.08);
  font-size: 0.82rem;
  font-weight: 750;
}

.install-app[hidden] {
  display: none;
}

.install-app svg {
  width: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.72rem;
  min-height: 2.9rem;
  padding: 0 0.85rem;
  border-radius: 0.8rem;
  color: #aab7ca;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 650;
}

button.nav-item {
  border: 0;
  text-align: left;
  background: transparent;
}

button.nav-item.active {
  background: rgba(255, 255, 255, 0.09);
}

.nav-toggle > span:nth-last-child(2) {
  flex: 1;
}

.nav-chevron {
  font-size: 1rem;
  transition: transform 160ms ease;
}

.nav-toggle[aria-expanded="true"] .nav-chevron {
  transform: rotate(180deg);
}

.nav-tree {
  display: grid;
  gap: 0.15rem;
  margin: 0.22rem 0 0.7rem 1.55rem;
  padding-left: 0.68rem;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.tree-branch {
  display: grid;
  gap: 0.08rem;
}

.tree-link {
  width: 100%;
  min-height: 2rem;
  padding: 0.35rem 0.5rem;
  overflow: hidden;
  border: 0;
  border-radius: 0.48rem;
  color: #91a0b6;
  background: transparent;
  text-align: left;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.76rem;
  font-weight: 650;
}

.tree-link:hover,
.tree-link.current {
  color: white;
  background: rgba(255, 255, 255, 0.08);
}

.tree-link.current::before {
  content: "";
  display: inline-block;
  width: 0.38rem;
  height: 0.38rem;
  margin-right: 0.42rem;
  border-radius: 50%;
  background: var(--green-bright);
}

.camera-link {
  padding-left: 1.25rem;
  font-size: 0.72rem;
}

.nav-item svg {
  width: 1.15rem;
  fill: currentColor;
}

.nav-item.active {
  color: #f8fbff;
  background: rgba(255, 255, 255, 0.09);
}

.sidebar-foot {
  margin-top: auto;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.7rem;
  align-items: start;
  padding: 1rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.8rem;
}

.sidebar-foot span:last-child {
  display: grid;
}

.connection-dot {
  width: 0.55rem;
  height: 0.55rem;
  margin-top: 0.28rem;
  border-radius: 50%;
  background: var(--green-bright);
  box-shadow: 0 0 0 5px rgba(54, 214, 165, 0.12);
}

.workspace {
  width: min(100%, 96rem);
  margin: 0 auto;
  padding: 1.7rem clamp(1rem, 2.5vw, 2.6rem) 2rem;
}

.topbar,
.filter-heading,
.panel-heading,
.occupancy-head,
.occupancy-foot,
.page-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 0.18rem;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.65rem, 2.5vw, 2.25rem);
  line-height: 1.1;
  letter-spacing: -0.045em;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.quality-badge {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.3rem 0.72rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 750;
}

.quality-badge.complete {
  color: #06614e;
  background: var(--green-soft);
}

.quality-badge.inferred {
  color: #86500b;
  background: #fff1d9;
}

.quality-badge.incomplete {
  color: #8d2533;
  background: #fde8eb;
}

.quality-badge.neutral {
  color: var(--slate-600);
  background: var(--slate-100);
}

.last-updated {
  color: var(--slate-600);
  font-size: 0.78rem;
}

.filter-panel,
.panel,
.metric-card {
  border: 1px solid var(--slate-200);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.filter-panel {
  margin-top: 1.65rem;
  padding: 1.15rem 1.25rem 1.25rem;
  border-radius: var(--radius-lg);
}

.filter-heading p,
.activity-heading > p {
  margin: 0.22rem 0 0;
  color: var(--slate-600);
  font-size: 0.8rem;
}

.quick-periods {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 0.72rem;
  background: var(--slate-100);
}

.quick-button {
  min-height: 2rem;
  padding: 0.2rem 0.72rem;
  border: 0;
  border-radius: 0.55rem;
  color: var(--slate-600);
  background: transparent;
  font-size: 0.8rem;
  font-weight: 700;
}

.quick-button.active {
  color: var(--ink-900);
  background: white;
  box-shadow: 0 2px 10px rgba(20, 35, 55, 0.08);
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(7.5rem, 1fr)) auto;
  gap: 0.75rem;
  align-items: end;
  margin-top: 1rem;
}

.filters-grid label {
  display: grid;
  gap: 0.35rem;
}

.filters-grid label > span {
  color: var(--slate-600);
  font-size: 0.78rem;
  font-weight: 700;
}

.scope-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.8rem;
}

.view-scope {
  margin: 0;
  color: var(--slate-500);
  font-size: 0.76rem;
  font-weight: 650;
}

.live-camera-button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2rem;
  padding: 0.2rem 0.75rem;
  border: 1px solid #b9e7da;
  border-radius: 999px;
  color: #06614e;
  background: var(--green-soft);
  font-size: 0.76rem;
  font-weight: 800;
}

.camera-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.zone-config-button {
  min-height: 2rem;
  padding: 0.2rem 0.75rem;
  border: 1px solid #cfd8f8;
  border-radius: 999px;
  color: #304fae;
  background: #eef2ff;
  font-size: 0.76rem;
  font-weight: 800;
}

.zone-config-button:disabled {
  cursor: not-allowed;
  filter: grayscale(1);
  opacity: 0.48;
}

.live-camera-button span {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(11, 139, 111, 0.1);
}

.live-camera-button:disabled {
  cursor: not-allowed;
  filter: grayscale(1);
  opacity: 0.48;
}

.live-dialog {
  width: min(92vw, 64rem);
  padding: 1rem;
  border: 0;
  border-radius: 1.25rem;
  color: var(--ink-900);
  background: white;
  box-shadow: 0 28px 90px rgba(8, 17, 31, 0.36);
}

.live-dialog::backdrop {
  background: rgba(8, 17, 31, 0.76);
  backdrop-filter: blur(4px);
}

.live-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.2rem 0.2rem 0.85rem;
}

.close-live {
  width: 2.4rem;
  height: 2.4rem;
  border: 0;
  border-radius: 50%;
  color: var(--slate-600);
  background: var(--slate-100);
  font-size: 1.55rem;
  line-height: 1;
}

.live-stage {
  position: relative;
  min-height: min(60vh, 34rem);
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: 0.95rem;
  color: #c3cfdf;
  background: var(--ink-950);
}

.live-stage img {
  z-index: 1;
  width: 100%;
  height: 100%;
  max-height: 70vh;
  object-fit: contain;
}

.live-stage p {
  position: absolute;
  margin: 0;
  font-size: 0.86rem;
}

.live-privacy {
  margin: 0.75rem 0 0.1rem;
  color: var(--slate-500);
  font-size: 0.74rem;
  text-align: center;
}

.zone-dialog {
  width: min(94vw, 60rem);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding: 1.1rem;
  border: 0;
  border-radius: 1.25rem;
  color: var(--ink-900);
  background: white;
  box-shadow: 0 28px 90px rgba(8, 17, 31, 0.36);
}

.zone-dialog::backdrop {
  background: rgba(8, 17, 31, 0.76);
  backdrop-filter: blur(4px);
}

.zone-dialog-head,
.zone-progress-row,
.zone-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.zone-dialog-head {
  padding: 0.15rem 0.15rem 1rem;
  border-bottom: 1px solid var(--slate-200);
}

.zone-step {
  padding: 1.1rem 0.15rem 0.15rem;
}

.zone-step[hidden] {
  display: none;
}

.zone-step h3 {
  margin: 0;
  font-size: 1.15rem;
}

.zone-step > p {
  margin: 0.35rem 0 0;
  color: var(--slate-600);
  font-size: 0.86rem;
}

.zone-overview-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.zone-overview-heading h3,
.zone-overview-heading p {
  margin: 0;
}

.zone-overview-heading p {
  margin-top: 0.3rem;
  color: var(--slate-600);
  font-size: 0.82rem;
}

.zone-overview-heading .zone-primary-button {
  flex: 0 0 auto;
  margin-top: 0;
}

.zone-configuration-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.zone-configuration-card {
  display: grid;
  grid-template-columns: 4.2rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem;
  border: 1px solid var(--slate-200);
  border-radius: 0.85rem;
  background: #fff;
}

.zone-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
}

.zone-shape-preview {
  width: 4.2rem;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 0.55rem;
  background: linear-gradient(145deg, #e8eef7, #f8fafc);
}

.zone-shape-preview svg {
  display: block;
  width: 100%;
  height: 100%;
}

.zone-card-copy {
  min-width: 0;
}

.zone-card-copy strong,
.zone-card-copy span {
  display: block;
}

.zone-card-copy strong {
  overflow: hidden;
  font-size: 0.88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zone-card-copy span {
  margin-top: 0.2rem;
  color: var(--slate-500);
  font-size: 0.72rem;
}

.zone-card-view {
  min-height: 2.25rem;
  padding: 0 0.75rem;
  border: 1px solid var(--slate-300);
  border-radius: 0.65rem;
  color: var(--blue);
  background: white;
  font-size: 0.75rem;
  font-weight: 800;
}

.zone-card-view.primary {
  border-color: #b9c8fa;
  background: #f1f4ff;
}

.gate-fields {
  grid-template-columns: minmax(0, 24rem);
}

.zone-preview-stage {
  isolation: isolate;
}

.zone-preview-stage svg {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.zone-preview-stage polygon {
  vector-effect: non-scaling-stroke;
  fill: rgba(54, 214, 165, 0.24);
  stroke: #36d6a5;
  stroke-width: 4px;
}

.zone-preview-stage span {
  z-index: 3;
}

.zone-count-field,
.zone-fields label {
  display: grid;
  gap: 0.35rem;
  color: var(--slate-600);
  font-size: 0.78rem;
  font-weight: 750;
}

.zone-fields small {
  color: var(--slate-500);
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.35;
}

.zone-count-field {
  max-width: 13rem;
  margin-top: 1.2rem;
}

.zone-count-field input,
.zone-fields input,
.zone-fields select {
  min-height: 2.75rem;
  padding: 0 0.72rem;
  border: 1px solid var(--slate-300);
  border-radius: 0.7rem;
  color: var(--ink-900);
  background: white;
}

.zone-primary-button,
.zone-secondary-button {
  min-height: 2.55rem;
  padding: 0 0.9rem;
  border-radius: 0.7rem;
  font-size: 0.8rem;
  font-weight: 800;
}

.zone-primary-button {
  margin-top: 1.1rem;
  border: 0;
  color: white;
  background: var(--blue);
}

.zone-secondary-button {
  border: 1px solid var(--slate-300);
  color: var(--ink-800);
  background: white;
}

.zone-primary-button:disabled,
.zone-secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.zone-progress-row > div {
  display: grid;
}

.zone-progress-row span {
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.zone-progress-row strong {
  margin-top: 0.12rem;
  font-size: 1rem;
}

.zone-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(12rem, 0.35fr);
  gap: 0.75rem;
  margin-top: 1rem;
}

.zone-instruction {
  padding: 0.65rem 0.8rem;
  border-radius: 0.65rem;
  color: #304fae !important;
  background: #eef2ff;
  font-weight: 700;
}

.zone-stage {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  margin-top: 0.75rem;
  border-radius: 0.9rem;
  color: var(--slate-600);
  background: var(--slate-100);
}

.zone-stage img,
.zone-stage canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: 58vh;
  object-fit: contain;
  background: transparent;
}

.zone-stage canvas {
  cursor: crosshair;
}

.zone-stage span {
  position: absolute;
  pointer-events: none;
  font-size: 0.84rem;
  padding: 0.55rem 0.75rem;
  border-radius: 999px;
  color: var(--slate-700);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 24px rgba(8, 17, 31, 0.12);
}

.zone-toolbar {
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.zone-toolbar .zone-primary-button {
  margin-top: 0;
}

.zone-save-result {
  margin-top: 0.75rem;
  padding: 0.7rem 0.8rem;
  border-radius: 0.65rem;
  color: #06614e;
  background: var(--green-soft);
  font-size: 0.8rem;
  font-weight: 750;
}

.zone-save-result.error {
  color: #8d2533;
  background: #fde8eb;
}

.view-scope::before {
  content: "";
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.45rem;
  border-radius: 50%;
  background: var(--green);
}

.filters-grid input,
.filters-grid select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0 0.72rem;
  border: 1px solid var(--slate-300);
  border-radius: 0.7rem;
  color: var(--ink-900);
  background: white;
  font-size: 0.84rem;
}

.apply-button {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0 1rem;
  border: 0;
  border-radius: 0.72rem;
  color: white;
  background: var(--ink-900);
  font-size: 0.84rem;
  font-weight: 750;
  box-shadow: 0 8px 20px rgba(11, 22, 40, 0.16);
}

.apply-button:hover {
  background: var(--ink-800);
}

.apply-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.apply-button svg {
  width: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.error-banner {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid #f2bcc4;
  border-radius: var(--radius-md);
  color: #7e2431;
  background: #fff1f3;
  font-size: 0.88rem;
}

.error-banner strong {
  margin-right: 0.35rem;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}

.metric-card {
  position: relative;
  overflow: hidden;
  min-height: 8.8rem;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  border-radius: var(--radius-md);
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 0.23rem;
  background: var(--card-accent);
}

.metric-card > span {
  color: var(--slate-600);
  font-size: 0.8rem;
  font-weight: 700;
}

.metric-card > strong {
  margin-top: 0.45rem;
  color: var(--ink-900);
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  line-height: 1;
  letter-spacing: -0.055em;
}

.metric-card > small {
  margin-top: auto;
  color: var(--slate-500);
  font-size: 0.74rem;
}

.accent-green { --card-accent: var(--green); }
.accent-blue { --card-accent: var(--blue); }
.accent-violet { --card-accent: var(--violet); }
.accent-amber { --card-accent: var(--amber); }
.accent-ink { --card-accent: var(--ink-700); }

.analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(16rem, 0.65fr);
  gap: 1rem;
  margin-top: 1rem;
}

.panel,
.occupancy-panel {
  border-radius: var(--radius-lg);
}

.panel {
  padding: 1.15rem 1.25rem;
}

.legend {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  color: var(--slate-600);
  font-size: 0.76rem;
  font-weight: 650;
}

.legend i {
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 0.18rem;
  background: var(--green);
}

.chart-scroll {
  overflow-x: auto;
  margin-top: 0.8rem;
  scrollbar-color: var(--slate-300) transparent;
}

.chart {
  min-height: 15.5rem;
}

.chart svg {
  display: block;
  width: auto;
  min-width: 100%;
  height: 15.5rem;
}

.chart-grid-line {
  stroke: var(--slate-100);
  stroke-width: 1;
}

.chart-axis-label,
.chart-hour {
  fill: var(--slate-500);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 650;
}

.chart-value {
  fill: var(--ink-800);
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 800;
}

.chart-bar {
  fill: var(--green);
  transition: fill 160ms ease;
}

.chart-bar-group:hover .chart-bar {
  fill: #08775f;
}

.chart-empty {
  min-height: 15.5rem;
  display: grid;
  place-items: center;
  color: var(--slate-500);
  font-size: 0.9rem;
}

.occupancy-panel {
  position: relative;
  overflow: hidden;
  padding: 1.25rem;
  color: white;
  background:
    radial-gradient(circle at 85% 12%, rgba(54, 214, 165, 0.26), transparent 34%),
    linear-gradient(145deg, #12233a, #08111f);
  box-shadow: 0 22px 50px rgba(8, 17, 31, 0.22);
}

.occupancy-panel::after {
  content: "";
  position: absolute;
  right: -2.5rem;
  bottom: -3.5rem;
  width: 10rem;
  height: 10rem;
  border: 1px solid rgba(54, 214, 165, 0.18);
  border-radius: 50%;
  box-shadow: 0 0 0 2rem rgba(54, 214, 165, 0.035), 0 0 0 4rem rgba(54, 214, 165, 0.02);
}

.occupancy-head,
.occupancy-value-wrap,
.occupancy-scale,
.occupancy-foot {
  position: relative;
  z-index: 1;
}

.occupancy-head p {
  margin-bottom: 0.1rem;
  color: #9fb0c6;
  font-size: 0.76rem;
  font-weight: 700;
}

.occupancy-head h2 {
  font-size: 1.08rem;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: #d9fff3;
  font-size: 0.75rem;
  font-weight: 750;
}

.live-indicator i {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--green-bright);
  box-shadow: 0 0 0 5px rgba(54, 214, 165, 0.12);
}

.occupancy-value-wrap {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  margin-top: 2.4rem;
}

.occupancy-value-wrap strong {
  font-size: clamp(4rem, 8vw, 6.2rem);
  line-height: 0.82;
  letter-spacing: -0.09em;
}

.occupancy-value-wrap span {
  color: #aab8ca;
  font-size: 0.82rem;
}

.occupancy-scale {
  height: 0.42rem;
  margin-top: 2.25rem;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
}

.occupancy-scale span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--green-bright));
  transition: width 350ms ease;
}

.occupancy-foot {
  margin-top: 0.8rem;
  color: #aab8ca;
  font-size: 0.78rem;
}

.occupancy-foot strong {
  color: white;
  font-size: 1rem;
}

.activity-panel {
  margin-top: 1rem;
}

.table-wrap {
  overflow-x: auto;
  margin: 0.85rem -0.25rem -0.25rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

th,
td {
  padding: 0.78rem 0.7rem;
  border-bottom: 1px solid var(--slate-100);
  text-align: left;
  font-size: 0.82rem;
}

th {
  color: var(--slate-500);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.event-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
}

.event-icon {
  width: 1.8rem;
  height: 1.8rem;
  display: grid;
  place-items: center;
  border-radius: 0.55rem;
  background: var(--slate-100);
}

.event-icon.entry { color: var(--green); background: var(--green-soft); }
.event-icon.exit { color: var(--violet); background: #eeeafd; }
.event-icon.inferred { color: var(--amber); background: #fff1d9; }

.source-pill {
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  color: var(--slate-600);
  background: var(--slate-100);
  font-size: 0.72rem;
  font-weight: 700;
}

.source-pill.inferred {
  color: #86500b;
  background: #fff1d9;
}

.empty-cell {
  padding: 2rem;
  color: var(--slate-500);
  text-align: center;
}

.page-footer {
  margin-top: 1.2rem;
  color: var(--slate-500);
  font-size: 0.74rem;
}

.page-footer span:first-child {
  color: var(--ink-700);
  font-weight: 800;
}

.is-loading .metric-card strong,
.is-loading .occupancy-value-wrap strong {
  color: transparent;
  border-radius: 0.4rem;
  background: linear-gradient(90deg, #e9eef4 25%, #f7f9fb 50%, #e9eef4 75%);
  background-size: 200% 100%;
  animation: shimmer 1.25s infinite;
}

.is-loading .occupancy-value-wrap strong {
  background: rgba(255, 255, 255, 0.13);
}

@keyframes shimmer {
  to { background-position: -200% 0; }
}

@media (max-width: 1120px) {
  .metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .filters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .apply-button {
    grid-column: span 2;
  }
}

@media (max-width: 820px) {
  body.mobile-nav-open {
    overflow: hidden;
  }

  body::before {
    content: "";
    position: fixed;
    z-index: 90;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    background: rgba(3, 10, 20, 0.58);
    backdrop-filter: blur(2px);
    transition: opacity 180ms ease;
  }

  body.mobile-nav-open::before {
    pointer-events: auto;
    opacity: 1;
  }

  .app-shell {
    grid-template-columns: minmax(0, 1fr);
    overflow-x: clip;
  }

  .sidebar {
    position: sticky;
    z-index: 100;
    top: 0;
    width: auto;
    height: auto;
    min-height: 4.5rem;
    flex-direction: row;
    align-items: center;
    padding: 0.8rem 1rem;
    width: 100%;
    min-width: 0;
  }

  .workspace {
    width: 100%;
    min-width: 0;
  }

  .mobile-menu-toggle {
    min-width: 3rem;
    min-height: 3rem;
    order: 1;
    margin-left: 0;
    padding: 0 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.42rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 0.78rem;
    color: #f8fbff;
    background: rgba(255, 255, 255, 0.08);
    font-size: 0.78rem;
    font-weight: 800;
  }

  .sidebar .brand {
    position: relative;
    z-index: 102;
    order: 2;
    margin-left: 0.65rem;
  }

  .mobile-menu-toggle {
    position: relative;
    z-index: 103;
  }

  .mobile-menu-toggle svg {
    width: 1.2rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
  }

  .mobile-menu-toggle[aria-expanded="true"] {
    color: var(--ink-950);
    background: var(--green-bright);
  }

  .brand-mark {
    width: 2.45rem;
    height: 2.45rem;
  }

  .primary-nav {
    position: fixed;
    z-index: 101;
    inset: 0 auto 0 0;
    width: min(21rem, calc(100vw - 3rem));
    min-width: 0;
    max-width: none;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: calc(5.4rem + env(safe-area-inset-top)) 1rem calc(1rem + env(safe-area-inset-bottom));
    display: grid;
    align-content: start;
    gap: 0.3rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    visibility: hidden;
    border: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0 1.15rem 1.15rem 0;
    background: linear-gradient(165deg, #10243a, var(--ink-950));
    box-shadow: 18px 0 42px rgba(3, 10, 20, 0.38);
    transform: translateX(-105%);
    transition: transform 200ms ease, visibility 200ms ease;
  }

  body.mobile-nav-open .primary-nav {
    visibility: visible;
    transform: translateX(0);
  }

  .mobile-nav-heading {
    margin: 0 0 0.75rem;
    display: block;
    color: #d9fff3;
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  .nav-group {
    position: static;
  }

  .nav-tree {
    position: static;
    width: auto;
    min-width: 0;
    max-height: none;
    margin: 0.15rem 0 0.55rem 1.45rem;
    padding: 0 0 0 0.65rem;
    overflow: visible;
    border: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .tree-link {
    max-width: 100%;
  }

  .install-app {
    width: 100%;
    min-height: 2.7rem;
    margin: 0.3rem 0 0;
  }

  .account-menu {
    margin-top: 1.15rem;
  }

  .nav-item {
    min-height: 2.5rem;
  }

  .nav-chevron {
    display: inline;
  }

  .sidebar-foot {
    display: none;
  }

  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .occupancy-panel {
    min-height: 18rem;
  }
}

@media (max-width: 620px) {
  .workspace {
    padding: 1.15rem 0.8rem 1.5rem;
  }

  .topbar,
  .filter-heading,
  .activity-heading,
  .page-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-status {
    width: 100%;
    justify-content: space-between;
  }

  .filter-panel,
  .panel,
  .occupancy-panel {
    border-radius: 1rem;
  }

  .quick-periods {
    width: 100%;
  }

  .quick-button {
    flex: 1;
  }

  .filters-grid,
  .metrics-grid {
    grid-template-columns: 1fr 1fr;
  }

  .filters-grid label {
    grid-column: span 2;
  }

  .scope-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .camera-actions {
    width: 100%;
  }

  .camera-actions > button {
    flex: 1;
    justify-content: center;
  }

  .live-camera-button {
    width: 100%;
    justify-content: center;
  }

  .live-dialog {
    width: calc(100vw - 1rem);
    padding: 0.7rem;
    border-radius: 1rem;
  }

  .zone-dialog {
    width: calc(100vw - 0.6rem);
    max-height: calc(100vh - 0.6rem);
    padding: 0.7rem;
    border-radius: 0.9rem;
  }

  .zone-fields {
    grid-template-columns: 1fr;
  }

  .zone-overview-heading {
    display: grid;
  }

  .zone-overview-heading .zone-primary-button,
  .zone-configuration-list {
    width: 100%;
  }

  .zone-configuration-list {
    grid-template-columns: 1fr;
  }

  .zone-toolbar > button {
    flex: 1 1 calc(50% - 0.5rem);
  }

  .live-stage {
    min-height: 56vw;
  }

  .metric-card {
    min-height: 8.1rem;
  }

  .metric-card:last-child {
    grid-column: span 2;
  }

  .brand-copy small,
  .nav-item {
    font-size: 0.75rem;
  }

  .nav-item {
    gap: 0.35rem;
    padding: 0 0.55rem;
  }

  .nav-item svg {
    width: 1rem;
  }

  .install-app {
    font-size: 0.82rem;
  }

  .install-app svg {
    width: 1.15rem;
  }

  .page-footer {
    gap: 0.3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
