* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}
.container {
    max-width: 1200px;
    margin: 0 auto;
}
header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}
header h1 {
    font-size: 3em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}
.subtitle {
    font-size: 1.2em;
    opacity: 0.9;
}
.card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.card h2 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.5em;
}
.leeroy-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}
.leeroy-card.status-home {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}
.leeroy-card.status-mowing {
    background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%);
}
.leeroy-card.status-winter {
    background: linear-gradient(135deg, #d299c2 0%, #fef9d7 100%);
}
.leeroy-card.status-alert {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}
.status-display {
    text-align: center;
}
.status-icon {
    font-size: 4em;
    margin-bottom: 15px;
}
.status-text {
    font-size: 1.8em;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}
.status-details {
    font-size: 1.1em;
    color: #666;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}
.stat-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
}
.stat-label {
    display: block;
    font-size: 0.9em;
    color: #666;
    margin-bottom: 8px;
}
.stat-value {
    display: block;
    font-size: 1.5em;
    font-weight: bold;
    color: #333;
}
.camera-view {
    text-align: center;
}
#latest-image {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin-bottom: 15px;
    background: #f0f0f0;
}
.camera-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}
button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}
.btn-primary {
    background: #667eea;
    color: white;
}
.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}
.btn-secondary {
    background: #48bb78;
    color: white;
}
.btn-secondary:hover {
    background: #38a169;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.4);
}
.events-list {
    max-height: 400px;
    overflow-y: auto;
}
.event-item {
    padding: 12px;
    border-left: 4px solid #667eea;
    background: #f8f9fa;
    margin-bottom: 10px;
    border-radius: 5px;
}
.event-time {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 5px;
}
.event-message {
    font-weight: 500;
    color: #333;
}
.loading {
    text-align: center;
    color: #666;
    padding: 20px;
}
@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .camera-controls {
        flex-direction: column;
    }
}

/* Event thumbnails */
.event-content {
    display: flex;
    align-items: center;
    gap: 10px;
}
.event-thumbnail {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
}
.event-thumbnail:hover {
    opacity: 0.8;
    transform: scale(1.05);
    transition: all 0.2s;
}
.event-text {
    flex: 1;
}

/* ===== Holiday themes (2026-10-11) — body.theme-<key>, set server-side ===== */
.photo-frame {
    position: relative;
    display: inline-block;
    max-width: 100%;
    margin-bottom: 15px;
}
.photo-frame #latest-image { margin-bottom: 0; display: block; }
.holiday-banner {
    display: inline-block;
    margin-top: 14px;
    padding: 10px 22px;
    border-radius: 999px;
    font-size: 1.15em;
    font-weight: 700;
    background: rgba(255,255,255,0.92);
    color: #333;
    box-shadow: 0 6px 18px rgba(0,0,0,0.2);
}
.photo-caption {
    position: absolute;
    left: 50%;
    top: 12px;
    transform: translateX(-50%);
    padding: 6px 16px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.95em;
    white-space: nowrap;
    background: rgba(255,255,255,0.9);
    color: #333;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}
body[class*="theme-"] .photo-frame {
    padding: 10px;
    border-radius: 16px;
}
body[class*="theme-"] .photo-frame #latest-image { border-radius: 8px; }
.holiday-fall {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}
.container { position: relative; z-index: 1; }
.holiday-fall span {
    position: absolute;
    top: -40px;
    font-size: 22px;
    animation: holiday-fall linear infinite;
    opacity: 0.85;
}
@keyframes holiday-fall {
    to { transform: translateY(110vh) rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
    .holiday-fall { display: none; }
}
@media (max-width: 768px) {
    .photo-caption { font-size: 0.75em; white-space: normal; width: 85%; text-align: center; }
    .holiday-banner { font-size: 1em; }
}

/* Thanksgiving: harvest oranges and browns */
body.theme-thanksgiving { background: linear-gradient(135deg, #f6a04d 0%, #8b4513 100%); }
.theme-thanksgiving .photo-frame { background: repeating-linear-gradient(45deg, #c0632a 0 14px, #e8a33d 14px 28px); }
.theme-thanksgiving .holiday-banner, .theme-thanksgiving .photo-caption { background: #fff4e0; color: #7a3410; }
.theme-thanksgiving .btn-primary { background: #c0632a; }

/* Christmas: red and green, candy-cane frame */
body.theme-christmas { background: linear-gradient(135deg, #1e5631 0%, #0b2e1a 100%); }
.theme-christmas .photo-frame { background: repeating-linear-gradient(45deg, #c62828 0 14px, #ffffff 14px 28px); }
.theme-christmas .holiday-banner, .theme-christmas .photo-caption { background: #fff; color: #b71c1c; }
.theme-christmas .btn-primary { background: #c62828; }

/* New Year's: midnight blue and gold */
body.theme-newyear { background: linear-gradient(135deg, #141e30 0%, #243b55 100%); }
.theme-newyear .photo-frame { background: linear-gradient(135deg, #f7d774, #b8860b, #f7d774); }
.theme-newyear .holiday-banner, .theme-newyear .photo-caption { background: #1a1a2e; color: #f7d774; border: 2px solid #f7d774; }
.theme-newyear .btn-primary { background: #b8860b; }

/* Easter: pastels */
body.theme-easter { background: linear-gradient(135deg, #fbc2eb 0%, #a6c1ee 100%); }
.theme-easter .photo-frame { background: repeating-linear-gradient(45deg, #f9d5e5 0 14px, #c7f0db 14px 28px, #fff5ba 28px 42px, #cfe3ff 42px 56px); }
.theme-easter .holiday-banner, .theme-easter .photo-caption { background: #fffdf5; color: #8a4f9e; }
.theme-easter .btn-primary { background: #b07cc6; }
.theme-easter .subtitle { color: #5e3a72; opacity: 1; }
.theme-easter header h1 { text-shadow: 2px 2px 6px rgba(94,58,114,0.45); }

/* Halloween: night purple and pumpkin orange */
body.theme-halloween { background: linear-gradient(135deg, #2b1b3d 0%, #0d0d0d 100%); }
.theme-halloween .photo-frame { background: repeating-linear-gradient(45deg, #ff7518 0 14px, #1a1a1a 14px 28px); }
.theme-halloween .holiday-banner, .theme-halloween .photo-caption { background: #1a1a1a; color: #ff9a3c; border: 2px solid #ff7518; }
.theme-halloween .btn-primary { background: #ff7518; }

/* ===== Telemetry dashboard (2026-10-11) ===== */
.stat-value.small { font-size: 1.05em; }
.stat-sub { display: block; font-size: 0.78em; color: #777; margin-top: 4px; }
.kpi-grid { margin-bottom: 18px; }
.health-badge { font-size: 0.6em; padding: 4px 10px; border-radius: 12px; margin-left: 10px; vertical-align: middle; background: #eee; color: #333; }
.health-badge.good { background: #e3f4ea; color: #0b6b31; }
.health-badge.warning { background: #fdf1d8; color: #7a5200; }
.health-badge.critical { background: #fbe1e1; color: #9b1c1c; }
.health-checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 8px; }
.health-row { display: grid; grid-template-columns: 26px 1fr auto; grid-template-rows: auto auto; align-items: center;
  background: #f8f9fa; border-radius: 8px; padding: 8px 12px; border-left: 4px solid #ccc; }
.health-row.good { border-left-color: #1a9c55; }
.health-row.warning { border-left-color: #d99a00; }
.health-row.critical { border-left-color: #d03b3b; }
.h-icon { grid-row: span 2; }
.h-name { font-weight: 600; color: #333; }
.h-word { font-size: 0.8em; font-weight: 600; color: #555; }
.h-detail { grid-column: 2 / 4; font-size: 0.85em; color: #666; }
.range-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.range-btn { border: 1px solid #c9cdd6; background: #fff; color: #333; border-radius: 16px; padding: 5px 14px; cursor: pointer; font-size: 0.9em; }
.range-btn.active { background: #2a78d6; border-color: #2a78d6; color: #fff; }
.viz-grid { display: grid; gap: 12px; }
.viz-grid.three { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.viz-grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); margin-top: 12px; }
.viz-panel { background: #fcfcfb; border: 1px solid #ececec; border-radius: 10px; padding: 10px 10px 4px; min-width: 0; }
.viz-title { font-size: 0.9em; font-weight: 600; color: #333; margin-bottom: 4px; display: flex; justify-content: space-between; gap: 8px; }
.viz-now { font-weight: 400; color: #666; font-size: 0.9em; }
.viz-box { width: 100%; }
.viz-box svg { display: block; }
.viz-gridline { stroke: #e6e6e6; stroke-width: 1; }
.viz-axis { fill: #777; font-size: 10px; }
.viz-empty { fill: #999; font-size: 12px; }
.viz-line { fill: none; stroke: #2a78d6; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz-band { fill: #2a78d6; opacity: 0.14; }
.viz-dot { fill: #2a78d6; }
.viz-cross { stroke: #999; stroke-width: 1; stroke-dasharray: 3 3; }
.viz-mark { fill: #2a78d6; stroke: #fff; stroke-width: 2; }
.viz-bar { fill: #2a78d6; }
.viz-marker.short { fill: #9aa3b0; }
.viz-marker.long { fill: #d03b3b; }
.viz-note { font-size: 0.82em; color: #666; margin-top: 10px; line-height: 1.4; }
.viz-tip { position: fixed; display: none; z-index: 9999; pointer-events: none; background: #1f2430; color: #fff;
  font-size: 12px; line-height: 1.45; padding: 7px 10px; border-radius: 6px; box-shadow: 0 4px 14px rgba(0,0,0,.25); max-width: 260px; }
.viz-tip .muted { color: #c3c2b7; }
.mow-details { margin-top: 10px; }
.mow-details summary { cursor: pointer; font-weight: 600; color: #444; }
.table-wrap { max-height: 360px; overflow-y: auto; margin-top: 8px; }
.mow-table { width: 100%; border-collapse: collapse; font-size: 0.9em; }
.mow-table th { text-align: left; color: #666; font-weight: 600; border-bottom: 1px solid #ddd; padding: 6px; position: sticky; top: 0; background: #fff; }
.mow-table td { padding: 5px 6px; border-bottom: 1px solid #f0f0f0; color: #333; }
.mow-table tr.k-short td, .mow-table tr.k-long td:last-child { color: #888; }
.mow-table tr.k-long td:last-child { color: #9b1c1c; }
@media (max-width: 768px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } .health-checks { grid-template-columns: 1fr; } }
