:root {
  color-scheme:light;
  --bg:#f4f6f8;
  --panel:#fff;
  --text:#182b3a;
  --muted:#61727f;
  --line:#dde5ea;
  --accent:#087d75;
  --danger:#ac253a;
  --radius:14px;
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  font-size:15px;
  line-height:1.55;
  color:var(--text);
  background:var(--bg);
}

* {
  box-sizing:border-box;
}

body {
  margin:0;
}

a {
  color:var(--accent);
  text-underline-offset:3px;
}

button,input,select {
  font:inherit;
}

button,a,input,select {
  -webkit-tap-highlight-color:transparent;
}

a:focus-visible,button:focus-visible,input:focus-visible,select:focus-visible {
  outline:3px solid #edaa36;
  outline-offset:3px;
}

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

h1 {
  font-size:2rem;
  letter-spacing:-.04em;
  line-height:1.2;
  margin-bottom:0;
}

h2 {
  font-size:1.16rem;
  letter-spacing:-.02em;
  margin-bottom:12px;
}

small,.small {
  font-size:.83rem;
}

.muted {
  color:var(--muted);
}

.eyebrow,.nav-label {
  font-size:.7rem;
  font-weight:750;
  letter-spacing:.13em;
  margin-bottom:10px;
  color:var(--muted);
}

.brand {
  display:flex;
  align-items:center;
  gap:10px;
  text-decoration:none;
  color:var(--text);
  font-size:1.3rem;
  font-weight:750;
  white-space:nowrap;
}

.brand .muted {
  font-size:.85rem;
  font-weight:450;
}

.brand-mark {
  display:grid;
  place-items:center;
  width:34px;
  height:34px;
  border-radius:10px;
  background:var(--accent);
  color:#fff;
  font-size:1.2rem;
}

.sidebar {
  position:fixed;
  inset:0 auto 0 0;
  width:234px;
  padding:32px 22px;
  background:#fff;
  border-right:1px solid var(--line);
  display:flex;
  flex-direction:column;
}

.nav-label {
  margin-top:48px;
  margin-left:12px;
}

nav {
  display:flex;
  flex-direction:column;
  gap:6px;
}

nav a {
  color:var(--muted);
  text-decoration:none;
  padding:11px 14px;
  border-radius:8px;
  font-weight:600;
}

nav a:hover {
  background:var(--bg);
}

nav .selected {
  background:#e5f3f0;
  color:#08665e;
}

.sidebar-footer {
  margin-top:auto;
  color:var(--muted);
  font-size:.83rem;
  padding:20px 10px 0;
}

.sidebar-footer small {
  margin-left:15px;
}

.status-dot {
  display:inline-block;
  width:6px;
  height:6px;
  border-radius:100%;
  background:var(--accent);
  margin-right:5px;
}

.workspace {
  margin-left:234px;
}

.topbar {
  min-height:83px;
  padding:16px 40px;
  border-bottom:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  background:#fff;
  font-size:.87rem;
  color:var(--muted);
}

.account {
  display:flex;
  align-items:center;
  gap:22px;
  color:var(--text);
}

.account small {
  display:block;
  color:var(--muted);
}

main {
  max-width:1320px;
  padding:35px 40px;
  margin:auto;
}

.page-heading {
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:30px;
  gap:16px;
}

.panel {
  padding:25px;
  border:1px solid var(--line);
  border-radius:var(--radius);
  background:var(--panel);
  margin-bottom:22px;
}

.welcome {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:20px;
  border-top:3px solid var(--accent);
}

.welcome h2 {
  font-size:1.65rem;
}

.welcome p:last-child {
  max-width:680px;
  margin-bottom:0;
  color:var(--muted);
}

.badge {
  display:inline-block;
  padding:4px 10px;
  border:1px solid var(--line);
  border-radius:6px;
  background:#f5f7f9;
  color:var(--muted);
  font-size:.76rem;
  white-space:nowrap;
  font-weight:650;
}

.badge.positive {
  background:#e6f5ef;
  color:#18634e;
  border-color:#cfebde;
}

.stats {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(200px,1fr));
  gap:20px;
}

.stat {
  display:flex;
  flex-direction:column;
  gap:10px;
}

.stat>span,.stat>small {
  color:var(--muted);
  font-size:.83rem;
}

.stat>strong {
  font-size:1.7rem;
  letter-spacing:-.04em;
  line-height:1.3;
}

.stat strong small {
  font-weight:400;
  color:var(--muted);
}

.button {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:16px;
  text-decoration:none;
  border:1px solid var(--line);
  padding:10px 16px;
  border-radius:8px;
  cursor:pointer;
  font-weight:650;
  line-height:1.4;
  background:#fff;
  color:var(--text);
  font-size:.9rem;
}

.button:hover {
  filter:brightness(.96);
}

.button.primary {
  background:var(--accent);
  border-color:var(--accent);
  color:#fff;
}

.button.danger {
  background:var(--danger);
  border-color:var(--danger);
  color:#fff;
}

.button.quiet {
  background:transparent;
}

.button.full {
  width:100%;
  justify-content:space-between;
}

.toolbar,.section-heading {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:18px;
  margin-bottom:20px;
}

.toolbar p,.section-heading h2 {
  margin:0;
}

.table-wrap {
  overflow-x:auto;
}

table {
  border-collapse:collapse;
  width:100%;
  font-size:.87rem;
  white-space:nowrap;
}

th {
  text-align:left;
  color:var(--muted);
  font-size:.75rem;
  font-weight:650;
  padding:0 16px 14px 0;
}

td {
  padding:16px 16px 16px 0;
  border-top:1px solid var(--line);
}

th:last-child,td:last-child {
  padding-right:0;
}

.actions a {
  margin-right:15px;
}

.danger-text {
  color:var(--danger);
}

.form-panel {
  max-width:820px;
}

.form-stack {
  display:flex;
  flex-direction:column;
  gap:22px;
}

.form-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:20px;
}

label {
  display:flex;
  flex-direction:column;
  gap:8px;
  font-size:.88rem;
  font-weight:650;
}

label small {
  font-weight:400;
  color:var(--muted);
}

input,select {
  width:100%;
  border:1px solid #b8c7d1;
  border-radius:7px;
  padding:10px 12px;
  background:#fff;
  color:var(--text);
  min-height:45px;
}

select {
  max-width:380px;
}

.checkbox {
  display:flex;
  flex-direction:row;
  align-items:center;
  gap:10px;
}

.checkbox input {
  width:18px;
  height:18px;
  min-height:0;
  accent-color:var(--accent);
}

.form-actions {
  display:flex;
  flex-wrap:wrap;
  gap:12px;
}

.notice {
  padding:14px 16px;
  background:#edf3f7;
  border:1px solid #d3e0e9;
  border-radius:8px;
  margin:0 0 20px;
  font-size:.87rem;
}

.form-stack .notice {
  margin:0;
}

.notice.error {
  background:#fff0f1;
  color:#942238;
  border-color:#efc7cf;
}

.notice.success {
  background:#e6f5ef;
  color:#18634e;
  border-color:#cfebde;
}

.roles {
  font-size:.88rem;
  margin-bottom:0;
}

.roles dt {
  font-weight:700;
  margin-top:14px;
}

.roles dd {
  margin-left:0;
  color:var(--muted);
}

.footer {
  max-width:1320px;
  margin:auto;
  padding:0 40px 28px;
  color:var(--muted);
  font-size:.75rem;
}

.login-shell {
  width:100%;
  max-width:490px;
  padding:60px 24px;
}

.login-shell>.brand {
  justify-content:center;
  margin-bottom:36px;
}

.login-card {
  padding:34px;
  background:#fff;
  border:1px solid var(--line);
  border-radius:var(--radius);
}

.login-card h1 {
  font-size:1.65rem;
  margin-bottom:12px;
}

.login-card>.muted {
  font-size:.9rem;
  margin-bottom:28px;
}

.login-footnote {
  text-align:center;
  color:var(--muted);
  font-size:.8rem;
  margin-top:24px;
}

@media(max-width:1000px) {
  .sidebar {
    width:190px;
    padding:24px 14px;
  }
  .workspace {
    margin-left:190px;
  }
  main {
    padding:28px 24px;
  }
  .topbar {
    padding:16px 24px;
  }
  .welcome {
    flex-direction:column;
  }
  .topbar>span {
    display:none;
  }
  .account {
    margin-left:auto;
  }
  .footer {
    padding-left:24px;
  }
}

@media(max-width:650px) {
  .sidebar {
    position:static;
    width:auto;
    padding:16px 20px;
    border-right:0;
    border-bottom:1px solid var(--line);
    gap:16px;
  }
  .nav-label,.sidebar-footer {
    display:none;
  }
  nav {
    flex-direction:row;
    flex-wrap:wrap;
  }
  nav a {
    padding:8px 12px;
  }
  .workspace {
    margin-left:0;
  }
  .topbar {
    padding:12px 20px;
    min-height:65px;
  }
  .account {
    width:100%;
    justify-content:space-between;
  }
  main {
    padding:25px 16px;
  }
  h1 {
    font-size:1.65rem;
  }
  .panel {
    padding:20px;
  }
  .stats {
    gap:0;
    grid-template-columns:1fr;
  }
  .stat {
    gap:7px;
  }
  .toolbar {
    align-items:flex-start;
    flex-direction:column;
  }
  .form-grid {
    grid-template-columns:1fr;
  }
  .section-heading {
    flex-wrap:wrap;
  }
  .login-shell {
    padding-top:36px;
  }
  .login-card {
    padding:26px 22px;
  }
  .footer {
    padding-left:16px;
  }
  .page-heading {
    margin-bottom:24px;
  }
  .welcome h2 {
    font-size:1.4rem;
  }
}

fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 20px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
legend { font-weight: 700; padding: 0 8px; }
details summary { cursor: pointer; color: var(--accent); margin-bottom: 14px; }
.camera-actions { margin-top: 22px; }

.recording-player {display:block;width:100%;max-height:70vh;background:#101820;border-radius:8px;margin:1rem 0}

.live-grid {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,360px),1fr));gap:1rem;align-items:start}
.live-grid:has(.live-tile:only-child) {grid-template-columns:1fr}
.live-tile {min-width:0;margin:0}.live-video {display:block;width:100%;aspect-ratio:16/9;background:#101820;border-radius:8px}.live-status {min-height:2.5em}.live-choices {display:flex;flex-wrap:wrap;gap:.5rem 1.5rem;margin-bottom:1rem}

/* Motion event history */
.events-filters {display:flex;align-items:flex-end;flex-wrap:wrap;gap:12px;padding-bottom:24px;border-bottom:1px solid var(--line);margin-bottom:24px}
.events-filters label {flex:1 1 220px;max-width:340px}
.events-filters .button {min-height:45px}
.events-heading {display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:22px}
.events-heading h2 {margin:0}
.events-table th {padding-bottom:12px}
.events-table td {vertical-align:middle}
.events-camera {font-weight:650;white-space:normal;overflow-wrap:anywhere;min-width:130px}
.events-time {display:block;color:var(--muted);font-size:.83rem;font-variant-numeric:tabular-nums}
.event-status {display:inline-block;padding:4px 10px;border-radius:6px;background:#eef2f5;color:#52616e;font-size:.76rem;font-weight:650;white-space:nowrap}
.event-status-ready {background:#e5f3ed;color:#17654e}
.event-status-active {background:#e5f3f0;color:#08665e}
.event-status-retry {background:#fff2df;color:#865008}
.event-status-pending {background:#eaf1fc;color:#345c8c}
.events-action {text-align:right}
.events-action .button {font-size:.8rem;white-space:nowrap;gap:10px}
.events-table tbody tr:hover {background:#f8fafb}
.events-pagination {display:flex;justify-content:flex-end;margin-top:22px}
.events-empty {padding:30px 12px;text-align:center}
.events-empty p {margin-bottom:0}
.events-sr-only {position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
@media (max-width:700px) {
 .events-filters label {flex-basis:100%;max-width:none}
 .events-filters select {max-width:none}
 .events-heading {align-items:baseline}
 .events-table,.events-table tbody {display:block;white-space:normal}
 .events-table thead {position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}
 .events-table tr {display:block;border:1px solid var(--line);border-radius:10px;padding:14px;margin-bottom:12px}
 .events-table td {display:flex;align-items:center;justify-content:space-between;gap:16px;padding:7px 0;border:0;text-align:right;min-width:0}
 .events-table td[data-label]::before {content:attr(data-label);font-size:.75rem;font-weight:500;color:var(--muted);text-align:left;flex-shrink:0}
 .events-table .events-action {justify-content:flex-end;padding-top:12px;margin-top:7px;border-top:1px solid var(--line)}
 .events-table .events-action .button {width:100%;justify-content:center}
}
