:root{--bg-primary: #030712;--bg-secondary: #0a0f1a;--bg-card: #0f172a;--bg-elevated: #1e293b;--text-primary: #f1f5f9;--text-secondary: #94a3b8;--text-muted: #64748b;--border-subtle: rgba(148, 163, 184, .15);--border-medium: rgba(148, 163, 184, .25);--accent-amber: #f59e0b;--accent-emerald: #10b981;--accent-blue: #3b82f6;--accent-purple: #8b5cf6;--accent-rose: #f43f5e;--shadow-glow: 0 0 60px rgba(59, 130, 246, .08);--shadow-card: 0 4px 24px rgba(0, 0, 0, .4);--font-display: "SF Pro Display", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;--font-mono: "SF Mono", ui-monospace, Menlo, Monaco, "Cascadia Code", monospace}*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}body{font-family:var(--font-display);background:var(--bg-primary);background-image:radial-gradient(ellipse 80% 50% at 50% -20%,rgba(59,130,246,.08),transparent),radial-gradient(ellipse 60% 40% at 100% 100%,rgba(139,92,246,.06),transparent);color:var(--text-primary);min-height:100vh;-webkit-font-smoothing:antialiased}.app{height:100vh;width:100vw;display:flex;flex-direction:column;padding:12px 16px;gap:12px;overflow:hidden;box-sizing:border-box}.app.app-dashboard{padding:8px 10px;gap:8px}.header{display:flex;justify-content:space-between;align-items:center;padding:10px 20px;background:linear-gradient(135deg,var(--bg-card),var(--bg-secondary));border:1px solid var(--border-subtle);border-radius:12px;box-shadow:var(--shadow-card);flex-shrink:0}.header-left h1{font-size:1.25rem;font-weight:600;letter-spacing:-.02em;background:linear-gradient(135deg,#fff,#94a3b8);-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text}.header-subtitle{font-size:.7rem;color:var(--text-muted);margin-top:2px;display:block}.header-right{display:flex;align-items:center;gap:16px}.environment-card{display:flex;align-items:center;gap:14px;padding:8px 14px;background:#0f172a99;border:1px solid var(--border-subtle);border-radius:10px}.environment-header{display:flex;align-items:center;gap:6px}.environment-icon{font-size:1rem}.environment-title{font-size:.7rem;color:var(--text-muted);text-transform:uppercase;letter-spacing:.05em}.environment-readings{display:flex;gap:14px}.env-reading{display:flex;flex-direction:column;align-items:center;gap:1px}.env-label{font-size:.65rem;color:var(--text-muted)}.env-value{font-size:.85rem;font-weight:600;font-family:var(--font-mono);color:var(--text-primary)}.header-clock{display:flex;flex-direction:column;align-items:flex-end;padding:6px 14px;background:#0f172a99;border:1px solid var(--border-subtle);border-radius:10px}.clock-time{font-size:1.1rem;font-weight:600;font-family:var(--font-mono);letter-spacing:.02em}.clock-date{font-size:.7rem;color:var(--text-muted)}.main-layout{flex:1;display:grid;grid-template-columns:1fr 1fr;gap:14px;min-height:0;overflow:hidden;width:100%;max-width:100%;box-sizing:border-box}.main-layout.dashboard-active{gap:0}.main-layout-container{position:relative;width:100%}.main-layout.full-width{grid-template-columns:1fr}.main-layout.quad-view-active,.main-layout.sensors-view-active{gap:0}.view-container{position:absolute;top:0;right:0;bottom:0;left:0;min-height:0;overflow:hidden;flex:1;visibility:hidden;pointer-events:none;opacity:0;z-index:0}.view-container.view-active{display:flex;flex-direction:column;visibility:visible;pointer-events:auto;opacity:1;z-index:1}.view-container.view-dashboard.view-active{display:grid;grid-template-columns:1fr 1fr;gap:8px;align-items:stretch;min-height:0;width:100%;height:100%;box-sizing:border-box}.view-container.view-hidden{position:absolute;visibility:hidden;pointer-events:none;opacity:0;z-index:0}.video-section{display:flex;flex-direction:column;min-height:0;overflow:hidden;width:100%;max-width:100%;box-sizing:border-box;align-items:stretch;height:100%}.video-list{display:grid;grid-template-columns:1fr 1fr;grid-auto-rows:auto;gap:10px;flex:1;min-height:0;width:100%;overflow-y:auto;align-content:start}.video-list>.video-item{display:flex!important;flex-direction:column;min-height:0;overflow:hidden;gap:4px;width:100%;flex-shrink:1}.video-list .video-wrapper{width:100%;aspect-ratio:16 / 9;position:relative;flex-shrink:0;height:auto}.video-list .video-container{width:100%;height:100%}.video-list .video-label{flex-shrink:0;font-size:.6rem;padding:2px 8px}.video-item{display:flex;flex-direction:column;gap:8px;flex-shrink:0}.video-wrapper{width:100%;aspect-ratio:16 / 9;flex-shrink:0}.video-container{width:100%;height:100%;position:relative;background:#000;border:1px solid var(--border-subtle);border-radius:12px;overflow:hidden;box-shadow:var(--shadow-card),var(--shadow-glow)}.video-container.placeholder{background:var(--bg-secondary);border-style:dashed;display:flex;align-items:center;justify-content:center}.video-player{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;object-fit:contain;background:#000}.video-placeholder{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;color:var(--text-muted)}.placeholder-icon{font-size:3rem;opacity:.5}.video-placeholder code{padding:3px 8px;background:var(--bg-elevated);border-radius:4px;font-size:.75rem;font-family:var(--font-mono)}.video-label{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;background:#0f172acc;border:1px solid var(--border-subtle);border-radius:6px;font-size:.65rem;color:var(--text-muted);flex-shrink:0;align-self:flex-start}.quad-view{flex:1;display:flex;flex-direction:column;min-height:0;overflow:hidden;padding:0;height:100%}.quad-grid{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr 1fr;gap:10px;flex:1;min-height:0;width:100%;height:100%;align-content:stretch;align-items:stretch}.quad-grid .video-item{display:flex;flex-direction:column;min-height:0;height:100%;overflow:hidden;gap:4px}.quad-grid .video-wrapper{flex:1;min-height:0;width:100%;height:100%;aspect-ratio:unset;position:relative}.quad-grid .video-container{width:100%;height:100%}.quad-grid .video-label{flex-shrink:0;font-size:.6rem;padding:2px 8px}@media (max-width: 768px) or (orientation: portrait){.quad-grid{grid-template-columns:1fr;grid-template-rows:repeat(4,1fr)}}.sensors-view{flex:1;display:flex;flex-direction:column;min-height:0;overflow:hidden;padding:0;height:100%}.sensors-grid{display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(2,1fr);gap:8px;flex:1;min-height:0;width:100%;height:100%;overflow:hidden;padding:0}.sensors-grid .enclosure-card{height:100%;min-height:200px;min-width:200px;display:flex;flex-direction:column;overflow:hidden;padding:8px}.sensors-grid .enclosure-body{flex:1;min-height:0;overflow:hidden;display:flex;flex-direction:column}.sensors-grid .sensor-section{flex:1;min-height:0;display:flex;flex-direction:column}.sensors-grid .sensor-stack{flex:1;min-height:0;display:flex;flex-direction:column;gap:4px}.sensors-grid .sensor-reading{flex:1;min-height:80px;min-width:150px;display:flex;flex-direction:column}.sensors-grid .mini-chart{height:28px;min-width:100px;width:100%;flex-shrink:0;position:relative}.sensors-grid .sensor-section-label{font-size:.6rem;margin-bottom:4px}.sensors-grid .sensor-reading-header{margin-bottom:2px}.sensors-grid .sensor-stats{font-size:.55rem;margin-bottom:4px}.sensors-grid .sensor-value{font-size:.9rem}.sensors-grid .sensor-label{font-size:.65rem}.sensors-grid .environment-card-full{grid-column:span 2;display:flex;align-items:center;justify-content:center}.sensors-grid .environment-card-full .environment-card{width:100%;height:100%}@media (max-width: 768px){.sensors-view{height:auto;min-height:auto;overflow:visible}.sensors-grid{grid-template-columns:1fr;grid-template-rows:auto;gap:12px;overflow:visible;height:auto;min-height:auto;flex:none;align-content:start}.sensors-grid .environment-card-full{grid-column:1}.sensors-grid .enclosure-card{min-height:fit-content;height:auto;overflow:visible}.sensors-grid .enclosure-body{height:auto;min-height:auto;overflow:visible}.sensors-grid .sensor-section,.sensors-grid .sensor-stack,.sensors-grid .sensor-reading{height:auto;min-height:auto;flex:none}}.alerts-view{flex:1;display:flex;flex-direction:column;min-height:0;overflow:hidden;padding:20px;height:100%}.alerts-container{flex:1;display:flex;flex-direction:column;min-height:0;overflow:hidden;max-width:1200px;width:100%;margin:0 auto}.alerts-header{margin-bottom:24px;display:flex;justify-content:space-between;align-items:flex-start;gap:16px}.alerts-header h2{font-size:1.5rem;font-weight:600;color:var(--text-primary);margin:0 0 8px}.alerts-subtitle{font-size:.9rem;color:var(--text-muted);margin:0}.alerts-list{flex:1;display:flex;flex-direction:column;gap:12px;overflow-y:auto;padding-right:4px}.alerts-list::-webkit-scrollbar{width:6px}.alerts-list::-webkit-scrollbar-track{background:var(--bg-secondary);border-radius:3px}.alerts-list::-webkit-scrollbar-thumb{background:var(--border-medium);border-radius:3px}.alerts-list::-webkit-scrollbar-thumb:hover{background:var(--text-muted)}.alert-item{background:linear-gradient(145deg,var(--bg-card),var(--bg-secondary));border:1px solid var(--border-subtle);border-radius:12px;padding:16px;display:flex;align-items:flex-start;gap:16px;box-shadow:var(--shadow-card);transition:all .2s ease}.alert-item:hover{border-color:var(--border-medium);box-shadow:var(--shadow-card),var(--shadow-glow)}.alert-item.alert-placeholder{opacity:.6;border-style:dashed}.alert-icon{font-size:1.5rem;flex-shrink:0;width:40px;height:40px;display:flex;align-items:center;justify-content:center;background:var(--bg-elevated);border-radius:8px}.alert-content{flex:1;display:flex;flex-direction:column;gap:4px}.alert-title{font-size:1rem;font-weight:600;color:var(--text-primary)}.alert-message{font-size:.9rem;color:var(--text-muted);line-height:1.4}@media (max-width: 768px) or (orientation: portrait){.alerts-view{padding:12px}.alerts-header h2{font-size:1.25rem}.alert-item{padding:12px}}.live-dot{width:6px;height:6px;background:#ef4444;border-radius:50%;animation:pulse 2s ease-in-out infinite;flex-shrink:0}@keyframes pulse{0%,to{opacity:1}50%{opacity:.4}}.enclosures-section{display:flex;flex-direction:column;min-height:0;overflow:hidden;height:100%;width:100%;max-width:100%;box-sizing:border-box}.enclosures-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;flex:1;min-height:0;overflow-y:auto;padding-right:4px;align-content:start}.enclosures-grid::-webkit-scrollbar{width:6px}.enclosures-grid::-webkit-scrollbar-track{background:var(--bg-secondary);border-radius:3px}.enclosures-grid::-webkit-scrollbar-thumb{background:var(--border-medium);border-radius:3px}.enclosures-grid::-webkit-scrollbar-thumb:hover{background:var(--text-muted)}.enclosure-card{background:linear-gradient(145deg,var(--bg-card),var(--bg-secondary));border:1px solid var(--border-subtle);border-radius:12px;padding:12px;display:flex;flex-direction:column;gap:8px;box-shadow:var(--shadow-card);position:relative;overflow:visible;min-height:fit-content;height:auto}.enclosure-card:before{content:"";position:absolute;top:0;left:0;right:0;height:2px;background:linear-gradient(90deg,var(--accent),transparent)}.enclosure-header{display:flex;align-items:center;gap:8px;flex-shrink:0}.enclosure-emoji{font-size:1.1rem}.enclosure-title{font-size:.85rem;font-weight:600;color:var(--text-primary)}.enclosure-body{display:flex;flex-direction:column;gap:8px;flex:1;min-height:0;height:auto}.sensor-section{display:flex;flex-direction:column;gap:4px;min-height:0;height:auto}.sensor-section-label{font-size:.65rem;color:var(--text-muted);text-transform:uppercase;letter-spacing:.06em;flex-shrink:0}.sensor-row{display:grid;grid-template-columns:1fr 1fr;gap:6px}.sensor-row-3{grid-template-columns:1fr 1fr 1fr}.sensor-stack{display:flex;flex-direction:column;gap:4px;min-height:0;height:auto}.sensor-reading{background:#0f172a80;border:1px solid var(--border-subtle);border-radius:8px;padding:6px 8px;display:flex;flex-direction:column;gap:4px;min-height:0;height:auto}.sensor-reading-header{display:flex;justify-content:space-between;align-items:baseline;gap:4px;flex-shrink:0}.sensor-label{font-size:.65rem;color:var(--text-muted);display:flex;align-items:center;gap:3px}.sensor-icon{font-size:.7rem}.sensor-value{font-size:.85rem;font-weight:600;font-family:var(--font-mono)}.sensor-stats{display:flex;gap:8px;font-size:.6rem;font-family:var(--font-mono)}.stat-item{display:flex;align-items:center;gap:2px;padding:1px 4px;border-radius:3px;background:#0f172a99}.stat-low{color:#38bdf8}.stat-high{color:#f87171}.mini-chart{height:44px;min-width:100px;width:100%;position:relative}.loading-state,.error-state{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;gap:12px;color:var(--text-muted)}.loading-spinner{width:32px;height:32px;border:3px solid var(--border-subtle);border-top-color:var(--accent-blue);border-radius:50%;animation:spin 1s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.recharts-tooltip-wrapper{z-index:1000}@media (max-width: 1200px){.main-layout{grid-template-columns:1fr;overflow-y:auto}.video-section{order:1}.enclosures-section{order:2;overflow:visible}.video-panels{flex-direction:row;flex-wrap:wrap}.video-panel{flex:1 1 300px;min-width:300px}.video-container{max-height:40vh}.enclosures-grid{grid-template-columns:1fr 1fr;overflow:visible;height:auto}.enclosure-card{min-height:200px}}@media (min-width: 769px) and (max-width: 1400px){.view-container.view-dashboard.view-active .enclosures-section{overflow:hidden;min-height:0}.view-container.view-dashboard.view-active .enclosures-grid{overflow-y:auto;min-height:0}}@media (max-width: 768px){.app{padding:10px;gap:10px;height:auto;min-height:100vh;overflow-y:auto}.header{flex-direction:row;align-items:center;justify-content:space-between;gap:10px;padding:12px}.header-left{display:flex;align-items:center;gap:12px;flex:0 0 auto;min-width:0}.header-left h1{font-size:1rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.header-subtitle{display:none}.header-right{display:flex;align-items:center;gap:12px;flex:1;justify-content:space-between;min-width:0}.header-clock{order:-1;flex-shrink:0}.header-right .environment-card{display:none}.mobile-nav-toggle{order:999;flex-shrink:0;margin-left:auto}.main-layout{grid-template-columns:1fr;overflow:visible;height:auto;min-height:auto}.main-layout-container{height:auto;min-height:auto;overflow:visible}.view-container.view-dashboard.view-active{display:flex;flex-direction:column;gap:12px;position:relative;height:auto;min-height:auto;overflow:visible}.main-layout.sensors-view-active .view-container.view-active{height:auto;min-height:auto;overflow:visible;position:relative}.view-container.view-dashboard.view-active .video-list{grid-template-columns:1fr;grid-template-rows:repeat(5,auto);gap:12px;height:auto;min-height:auto;overflow:visible;flex:none}.view-container.view-dashboard.view-active .video-list .video-wrapper{aspect-ratio:16 / 9;height:auto}.view-container.view-dashboard.view-active .video-section{order:1;width:100%;height:auto;min-height:auto;overflow:visible;flex:none}.video-panels{flex-direction:column}.video-panel{flex:none;min-width:100%}.video-container{max-height:none}.view-container.view-dashboard.view-active .enclosures-section{order:2;overflow:visible;width:100%;height:auto;min-height:auto;flex:none}.view-container.view-dashboard.view-active .enclosures-grid{grid-template-columns:1fr;overflow:visible;height:auto;min-height:auto;padding-right:0;flex:none}.view-container.view-dashboard.view-active .enclosure-card{min-height:fit-content;height:auto}.sensor-row-3{grid-template-columns:1fr 1fr}.mini-chart{height:40px}}@media (max-width: 480px){.app{padding:8px}.environment-card{display:none}.header-clock{padding:4px 10px}.clock-time{font-size:1rem}.enclosure-card{padding:10px}.sensor-row,.sensor-row-3{grid-template-columns:1fr}.mini-chart{height:36px}.video-label{font-size:.6rem}}.snapshot-button{position:relative;width:36px;height:36px;border-radius:50%;background:#0009;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);border:1px solid rgba(255,255,255,.2);color:#fff;display:flex;align-items:center;justify-content:center;cursor:pointer;z-index:20;transition:all .2s ease;flex-shrink:0}.snapshot-button:active:not(:disabled){transform:scale(.95)}.snapshot-button:disabled{opacity:.5;cursor:not-allowed}.snapshot-spinner{width:18px;height:18px;border:2px solid rgba(255,255,255,.3);border-top-color:#fff;border-radius:50%;animation:spin .8s linear infinite}@keyframes flash{0%{opacity:.8}to{opacity:0}}.snapshots-view{flex:1;display:flex;flex-direction:column;gap:20px;min-height:0;overflow:hidden}.health-warning{padding:10px 16px;background:#f43f5e1a;border:1px solid var(--accent-rose);border-radius:8px;color:var(--accent-rose);font-size:.85rem;display:flex;align-items:center;gap:10px}.snapshot-error{width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;background:var(--bg-secondary);color:var(--text-muted);font-size:.75rem}.snapshots-header{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:16px}.snapshots-header-left{display:flex;flex-direction:column;gap:4px}.snapshots-header-actions{display:flex;gap:10px}.action-button.download-all{background:#3b82f61a;border-color:#3b82f633;color:var(--accent-blue);width:auto;flex:none}.action-button.download-all:hover{background:var(--accent-blue);color:#fff;border-color:var(--accent-blue)}.action-button.delete-all{background:#f43f5e1a;border-color:#f43f5e33;color:var(--accent-rose);width:auto;flex:none}.action-button.delete-all:hover{background:var(--accent-rose);color:#fff;border-color:var(--accent-rose)}.load-more-container{display:flex;justify-content:center;padding:20px 0 40px}.action-button.load-more{width:auto;padding:10px 24px;background:var(--accent-blue);color:#fff;border:none}.snapshots-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(400px,1fr));grid-auto-rows:max-content;gap:32px;flex:1;min-height:0;overflow-y:auto;padding:12px 12px 80px 0;align-content:start}.snapshot-card{background:var(--bg-card);border:1px solid var(--border-subtle);border-radius:12px;overflow:hidden;display:flex;flex-direction:column;box-shadow:var(--shadow-card);min-height:min-content}.snapshot-image-wrapper{position:relative;aspect-ratio:16 / 9;background:#000;flex-shrink:0}.snapshot-image{width:100%;height:100%;object-fit:contain}.snapshot-info{padding:16px;display:flex;flex-direction:column;gap:8px;flex-grow:1}.snapshot-meta{display:flex;justify-content:space-between;align-items:center}.snapshot-label{font-weight:600;font-size:.85rem}.snapshot-time{font-size:.7rem;color:var(--text-muted)}.snapshot-details{font-size:.65rem;color:var(--text-muted);display:flex;gap:8px}.snapshot-actions{display:flex;gap:8px;margin-top:8px}.action-button{flex:1;padding:8px 12px;min-height:36px;border-radius:6px;font-size:.75rem;font-weight:500;cursor:pointer;border:1px solid var(--border-subtle);background:var(--bg-elevated);color:var(--text-primary);display:flex;align-items:center;justify-content:center;gap:8px;transition:all .2s ease}.action-button:hover{background:var(--border-medium)}.action-button.delete:hover{background:var(--accent-rose);border-color:var(--accent-rose);color:#fff}.nav{display:flex;gap:8px}.nav-item{padding:6px 12px;border-radius:6px;font-size:.85rem;font-weight:500;color:var(--text-secondary);cursor:pointer;transition:all .2s ease;background:transparent;border:none}.nav-item:hover{background:var(--border-subtle);color:var(--text-primary)}.nav-item.active{background:var(--accent-blue);color:#fff}.mobile-nav-toggle{display:none}@media (max-width: 768px){.nav{display:none}.nav.mobile-active{display:flex;position:absolute;top:60px;right:20px;flex-direction:column;background:var(--bg-card);border:1px solid var(--border-medium);padding:8px;border-radius:8px;z-index:100;box-shadow:var(--shadow-card);min-width:150px}.mobile-nav-toggle{display:block;background:transparent;border:none;color:var(--text-primary);font-size:1.25rem;cursor:pointer;order:999;margin-left:auto}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}
