:root {
  color-scheme: light;
  --ink: #1a2a28;
  --muted: #697875;
  --paper: #f4f1e9;
  --card: #fffdf8;
  --line: #d9ddd6;
  --green: #2e655b;
  --green-dark: #214b44;
  --sage: #dbe7df;
  --amber: #a36d24;
  --shadow: 0 18px 60px rgba(35, 55, 51, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); min-height: 100vh; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }

.topbar {
  height: 72px; padding: 0 clamp(20px, 5vw, 72px); display: flex; align-items: center;
  justify-content: space-between; border-bottom: 1px solid rgba(26, 42, 40, .08);
}
.brand { display: flex; gap: 11px; align-items: center; color: var(--ink); text-decoration: none; font-weight: 750; letter-spacing: -.02em; }
.brand-mark { width: 22px; height: 22px; border: 6px solid var(--green); border-radius: 50%; box-shadow: inset 0 0 0 2px var(--paper); }
.top-actions { display: flex; align-items: center; gap: 12px; }
.privacy-badge { padding: 7px 11px; border-radius: 999px; background: var(--sage); color: var(--green-dark); font-size: 13px; font-weight: 700; }
.icon-button { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; font-size: 20px; }

main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.hero { padding: 68px 0 42px; display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; }
.eyebrow, .section-label { color: var(--green); text-transform: uppercase; letter-spacing: .13em; font-size: 12px; font-weight: 800; margin: 0 0 9px; }
h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(46px, 7vw, 78px); line-height: .97; letter-spacing: -.045em; margin: 0; font-weight: 500; }
.lede { max-width: 600px; color: var(--muted); font-size: 18px; line-height: 1.6; margin: 22px 0 0; }
.status-stack { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 10px 14px; font-size: 14px; font-weight: 750; }
.status-pill i { width: 8px; height: 8px; background: var(--amber); border-radius: 50%; }
.status-pill.online i { background: #3f8c64; box-shadow: 0 0 0 4px #dcecdf; }
.status-pill.offline i { background: #b44b42; }
.host-label { color: var(--muted); font-size: 13px; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 20px; align-items: stretch; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 26px; box-shadow: var(--shadow); }
.card-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 20px; }
h2 { font-family: Georgia, "Times New Roman", serif; font-size: 29px; font-weight: 500; letter-spacing: -.025em; margin: 0; }
.viewer-card { min-width: 0; display: flex; flex-direction: column; }
.live-indicator, .locked-label { border-radius: 999px; background: #edece6; color: var(--muted); padding: 7px 10px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.live-indicator.on { background: #eededb; color: #8b3934; }
.viewer-shell { aspect-ratio: 16 / 9; overflow: hidden; background: #172421; border-radius: 14px; position: relative; }
.viewer-shell video { width: 100%; height: 100%; display: none; object-fit: contain; background: #111b19; }
.viewer-shell.playing video { display: block; }
.viewer-shell.playing .viewer-empty { display: none; }
.viewer-empty { height: 100%; display: grid; place-content: center; text-align: center; gap: 8px; color: #d7e1dc; }
.viewer-empty span:last-child { color: #91a29d; font-size: 14px; }
.camera-glyph { width: 48px; height: 48px; margin: 0 auto 8px; border: 2px solid #668078; border-radius: 50%; display: grid; place-content: center; color: #668078; }
.viewer-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.primary-button, .secondary-button { border-radius: 10px; padding: 12px 16px; font-weight: 750; border: 1px solid transparent; cursor: pointer; }
.primary-button { background: var(--green); color: white; }
.primary-button:hover { background: var(--green-dark); }
.secondary-button { background: transparent; color: var(--ink); border-color: var(--line); }
.primary-button:disabled, .secondary-button:disabled { opacity: .55; cursor: progress; }
.helper { color: var(--muted); line-height: 1.5; font-size: 13px; margin: 14px 0 0; }

.control-column { display: grid; gap: 20px; }
.ptz-grid { width: 190px; margin: 5px auto 16px; display: grid; grid-template-columns: repeat(3, 54px); grid-template-areas: ". up ." "left home right" ". down ."; gap: 10px; justify-content: center; }
.ptz-grid button { width: 54px; height: 54px; border: 1px solid var(--line); background: #f8f6f0; border-radius: 50%; color: var(--muted); font-size: 20px; cursor: not-allowed; }
.ptz-card.enabled .ptz-grid button:not(:disabled) { cursor: pointer; color: var(--green); }
.ptz-card.enabled .ptz-grid button:not(:disabled):hover { background: var(--sage); border-color: #b9cec2; }
.ptz-grid button:disabled { opacity: .45; }
.ptz-grid [data-ptz="up"] { grid-area: up; } .ptz-grid [data-ptz="left"] { grid-area: left; } .ptz-grid [data-ptz="home"] { grid-area: home; } .ptz-grid [data-ptz="right"] { grid-area: right; } .ptz-grid [data-ptz="down"] { grid-area: down; }
.home-button { background: var(--sage) !important; color: var(--green) !important; }
.feature-list { list-style: none; padding: 0; margin: 18px 0 0; }
.feature-list li { display: flex; justify-content: space-between; gap: 16px; padding: 13px 0; border-top: 1px solid #e5e6e0; font-size: 14px; }
.feature-list strong { color: var(--green); }
.feature-list .muted { color: var(--muted); font-weight: 650; }

.events-section { padding: 64px 0 72px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 20px; }
.text-button { border: 0; background: transparent; color: var(--green); font-weight: 750; cursor: pointer; padding: 8px; }
.events-list { display: grid; gap: 10px; }
.event-row { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 14px; background: rgba(255, 253, 248, .72); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.event-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-content: center; background: var(--sage); color: var(--green); font-weight: 800; }
.event-title { font-weight: 760; margin: 0 0 3px; }.event-meta { color: var(--muted); font-size: 13px; margin: 0; }
.event-link { color: var(--green); font-weight: 750; text-decoration: none; }
.empty-state { color: var(--muted); border: 1px dashed #c8cec7; border-radius: 14px; padding: 34px; text-align: center; }
footer { width: min(1180px, calc(100% - 40px)); margin: 0 auto; border-top: 1px solid var(--line); padding: 24px 0 36px; display: flex; justify-content: space-between; gap: 20px; color: var(--muted); font-size: 13px; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 360px; padding: 13px 16px; background: var(--ink); color: white; border-radius: 10px; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

.event-card { width: 100%; display: grid; grid-template-columns: 150px 1fr 38px; align-items: center; gap: 18px; padding: 0; overflow: hidden; text-align: left; color: var(--ink); background: rgba(255,253,248,.82); border: 1px solid var(--line); border-radius: 16px; cursor: pointer; }
.event-card:hover { border-color: #a9c0b5; box-shadow: 0 8px 24px rgba(35,55,51,.08); }
.event-card img { width: 150px; height: 96px; object-fit: cover; background: #172421; }
.event-copy { min-width: 0; display: grid; gap: 4px; padding: 12px 0; }
.event-copy strong { font-size: 17px; }.event-copy>span:not(.event-kicker) { color: var(--muted); line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-copy small { color: var(--muted); }.event-kicker { color: var(--green); text-transform: uppercase; letter-spacing: .1em; font-size: 11px; font-weight: 800; }.play-mark { color: var(--green); font-size: 18px; }

dialog { width: min(760px, calc(100% - 28px)); max-height: calc(100dvh - 28px); overflow: auto; padding: 28px; border: 1px solid var(--line); border-radius: 18px; color: var(--ink); background: var(--card); box-shadow: 0 24px 90px rgba(12,25,22,.28); }
dialog::backdrop { background: rgba(14,28,25,.72); backdrop-filter: blur(4px); }.dialog-close { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: var(--card); font-size: 25px; cursor: pointer; }
.clip-dialog video { width: 100%; margin-top: 20px; background: #0f1917; border-radius: 12px; max-height: 60dvh; }.clip-description { font-size: 16px; line-height: 1.6; }
.stack-form { display: grid; gap: 14px; margin-top: 24px; }.stack-form label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }.stack-form input,.stack-form select { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--ink); font: inherit; }.stack-form input:focus,.stack-form select:focus { outline: 3px solid rgba(46,101,91,.16); border-color: var(--green); }.account-dialog hr { border: 0; border-top: 1px solid var(--line); margin: 30px 0; }.account-dialog h3 { margin: 24px 0 10px; }.signout-button { margin-top: 28px; color: #8b3934; }
.compact-list { display: grid; gap: 8px; }.compact-list>div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid #e7e8e2; }.compact-list span,.compact-list small { display: block; }.compact-list small { color: var(--muted); margin-top: 3px; }.compact-list em { color: var(--muted); font-style: normal; }

.login-page { min-height: 100dvh; display: grid; place-items: center; background: radial-gradient(circle at 20% 20%, #e1ebe4, transparent 38%), var(--paper); }.login-shell { width: min(500px, calc(100% - 28px)); margin: 36px auto; }.login-card { padding: clamp(26px,6vw,46px); }.login-card .brand { margin-bottom: 56px; }.login-card h1 { font-size: clamp(46px,12vw,68px); }.login-card .lede { font-size: 16px; }.form-error { min-height: 20px; color: #9d3731; margin: 0; font-weight: 700; }.login-card .primary-button { min-height: 48px; }

body.wide-view main { width: min(1600px, calc(100% - 24px)); }.wide-view .dashboard-grid { grid-template-columns: 1fr; }.wide-view .viewer-shell { aspect-ratio: auto; height: min(78dvh, 980px); }.wide-view .control-column { grid-template-columns: 1fr 1fr; }

@media (max-width: 820px) {
  .hero { padding-top: 44px; align-items: flex-start; flex-direction: column; }
  .status-stack { align-items: flex-start; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .control-column { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  main { width: min(100% - 24px, 1180px); }
  .topbar { padding: 0 14px; }.privacy-badge { display: none; }
  .hero { padding: 36px 2px 28px; }.lede { font-size: 16px; }
  .card { padding: 18px; border-radius: 16px; }
  .control-column { grid-template-columns: 1fr; }
  .viewer-actions { flex-direction: column; }.viewer-actions button { width: 100%; }
  .event-row { grid-template-columns: 40px 1fr; }.event-link { grid-column: 2; }
  .event-card { grid-template-columns: 108px 1fr 24px; gap: 11px; }.event-card img { width: 108px; height: 104px; }.event-copy>span:not(.event-kicker) { display: none; }.event-copy strong { font-size: 15px; }.event-copy small { font-size: 11px; }.play-mark { font-size: 14px; }
  .account-button { padding-inline: 4px; }.wide-view .viewer-shell { height: min(62dvh, 620px); }.wide-view .control-column { grid-template-columns: 1fr; }
  dialog { width: calc(100% - 14px); max-height: calc(100dvh - 14px); padding: 22px 16px; border-radius: 14px; }.clip-dialog video { max-height: 52dvh; }
  footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
