@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Serif:wght@500;600;700&family=Inter:wght@400;500;600;700;800&display=swap');

        .warning        { color:#b30000; font-weight:700; }
        .status-ok      { color:#006400; font-weight:600; }
        .status-warn    { color:#b30000; font-weight:600; }
.text-danger { color: var(--danger-600); }
.text-success { color: var(--success-600); }
.bg-overlay { background-color: var(--surface); }
.details { display: none; }
.details.open { display: block; }

html, body {
  overflow-x: hidden;
}

.tile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid currentColor;
  background: transparent;
}

.status-chip .material-symbols-rounded {
  font-size: 16px;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--brand-600);
  outline-offset: 2px;
}

.chip-ok {
  color: var(--success-600);
  border-style: solid;
}

.chip-hint {
  color: var(--brand-600);
  border-style: dotted;
}

.chip-warn {
  color: #b30000;
  border-style: dashed;
}

.chip-alarm {
  color: var(--danger-600);
  border-style: double;
  border-width: 2px;
}

/* Climate tile additions */
.timestamp {
  font-size: 0.75rem;
  margin-left: auto;
  color: var(--text-secondary);
}

.warn-strip {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 4px;
  margin-top: 4px;
  border-radius: var(--radius-1);
  font-size: 0.85rem;
}

.warn-strip.warn {
  display: flex;
  background: #fff3cd;
  color: #664d03;
}

.warn-strip.alarm {
  display: flex;
  background: #f8d7da;
  color: #842029;
}

.plant-response {
  display: none;
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-top: 4px;
}

.info-icon {
  background: none;
  border: none;
  padding: 0 0 0 4px;
  cursor: pointer;
  color: inherit;
}

.hidden { display: none !important; }
:root{
  /* Spacing & radius */
  --space-1:4px;
  --space-2:8px;
  --space-3:16px;
  --radius-1:6px;
  /* Surfaces & borders */
  --surface:#ffffffcc;
  --surface-border:#e6f7f0;
  /* Brand & semantic palette */
  --brand-600:#007a33; /* contrast 5.11 on body-bg */
  --success-600:#006400; /* contrast 6.93 on body-bg */
  --danger-600:#d50000; /* contrast 5.11 on body-bg */
  --text-secondary:#555;
  --body-bg:#f5f7fa;
  --text-primary:#222;
}

/* Dark theme palette tuned with WCAG contrast guidance */
body.dark-mode{
  --surface:#0f1d14cc;
  --surface-border:#173b2f;
  --brand-600:#00a95c; /* contrast 6.09 on body-bg */
  --success-600:#00e676; /* contrast 10.43 on surface */
  --danger-600:#ff8080; /* contrast 7.17 on surface */
  --text-secondary:#c7d1cc;
  --body-bg:#0b120d;
  --text-primary:#e0e0e0;
}
/* lighten monochrome icons for clarity on dark background without losing accent colours */
body.dark-mode img[src*="fonts.gstatic.com"] {
  filter: var(--icon-filter, brightness(1.8) saturate(1.2));
}
/* icons sitting on light surfaces keep their original colours */
body.dark-mode .booster-bubble,
body.dark-mode .nutri-item,
body.dark-mode .device-icon {
  --icon-filter: none;
}
body.dark-mode .button-image :is(img, svg, lottie-player, .lottie) {
  /* brighten icons for contrast on dark background */
  filter: brightness(1.8) saturate(1.2);
}
/* -----------------  tiny traffic-light circles  ------------------ */
.status-indicator        { width:14px; height:14px; border-radius:50%;
                           display:inline-block; margin-right:6px;
                           box-shadow:0 0 4px rgba(0,0,0,.4); }
.status-green            { background:#00c853; }   /* material green A700 */
.status-red              { background:#d50000; }   /* material red A700   */

/* nicer warning list */
#growWarnings           { margin:6px 0 0 6px; padding-left:14px; }
#growWarnings li        { list-style:none; margin:2px 0;
                          position:relative; padding-left:20px; }
#growWarnings li::before{ content:"⚠"; position:absolute; left:0; }

/* optional: colour ages >3 h amber even when not stale (purely cosmetic) */
.age-amber              { color:#ff8f00; font-weight:600; }
  /* give the little inline icons a predictable size */
.device-icon.sm   { width:20px; height:20px; }

/* red version used for any “bad / stale” condition */
.device-icon.bad  { }

        /* Slider container styling */
        .slider-container {
          margin: 15px 0;
        }
  /* centre big numbers inside the metric circles */
.metric-value      { font-size:1.25rem; font-weight:700; line-height:1; }
/* soft themed backgrounds for metric icons */
  .device-icon {
    background:#d8f3dc;
    border-radius:50%;
    color:#1f4b39;
  }
  body.dark-mode .device-icon {
    background:#1e4d3d;
    color:#f4fbf6;
  }
  .device-icon.good {
    border:2px solid #00c853;
  }
  .device-icon.bad {
    border:2px solid #d50000;
  }
/* red tint for stale‐FYTA icon */
.device-icon.stale { }   /* 🔴 */

        .slider-label {
          font-weight: bold;
          margin-bottom: 5px;
        }
  
        .slider-value {
          display: inline-block;
          margin-left: 10px;
          font-weight: bold;
          color: #333;
        }
  
        /* round-slider container */
        .round-slider-container {
          text-align: center;
          margin-top: 20px;
        }
        .tile-container > .tile:first-child {
          grid-column: 1 / -1; /* This makes the first tile span all columns */
          grid-row: 1; /* keep menu in the first grid row */
          width: 100%; /* stretch across the screen */
          justify-self: stretch;
          display: flex;
          flex-direction: row; /* lay out menu elements horizontally */
          justify-content: center;
          align-items: center;
          text-align: center;
        }
        .roundslider-label {
          margin-top: 10px;
          font-weight: bold;
        }
  
        /* Entries table */
        .entries-table {
          width: 100%;
          border-collapse: collapse;
          margin-top: 20px;
        }
  
        .entries-table th,
        .entries-table td {
          padding: 10px;
          border-bottom: 1px solid #ddd;
          white-space: normal; 
          word-wrap: break-word; 
          overflow-wrap: anywhere; 
          /* 
            Optionally:
            overflow-wrap: anywhere;
            word-break: break-all; 
          */
        }
        
  
        .entries-table th {
          background: #f0f0f0;
          font-weight: bold;
        }
  
        .entries-table tr:hover {
          background: #f9f9f9;
        }
  
        .entries-table caption {
          caption-side: top;
          font-weight: bold;
          table-layout: fixed; /* Force columns to share space proportionally */
          width: 100%;
          word-wrap: break-word;
          border-collapse: collapse;
        }  
      /* Copy entire style block from index */
      body {
        font-family: 'IBM Plex Serif', serif;
        margin: 0;
        padding: 0;
        border: none;
        background-color:var(--body-bg);
        color:var(--text-primary);
        background-image:none !important;
        max-width: none !important;
      }
      .device-timer {
        position: absolute;
        top: -5px;
        right: -5px;
        background: rgba(255, 0, 0, 0.7);
        color: #fff;
        padding: 2px 5px;
        border-radius: 50%;
        font-size: 0.8em;
      }
      .sensor-age-badge {
        position: absolute;
        top: -6px;
        right: -6px;
        min-width: 36px;
        text-align: center;
        background: rgba(0, 128, 64, 0.85);
        color: #fff;
        padding: 2px 6px;
        border-radius: 999px;
        font-size: 0.8em;
        line-height: 1.3;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
        transition: background-color 0.3s ease;
      }
      .sensor-age-badge.stale {
        background: rgba(200, 0, 0, 0.85);
      }
      .sensor-age-badge.fresh {
        background: rgba(0, 128, 64, 0.85);
      }
      .device-wrapper {
        position: relative;
        display: inline-block;
      }
      .tile-container {
        align-self: center;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 20px;
        font-family: 'IBM Plex Serif', serif;
      }
      
      @media (min-width: 600px) {
        .tile-container {
          grid-template-columns: repeat(2, 1fr); /* Two columns for medium screens */
        }
      }
      
      @media (min-width: 1024px) {
        .tile-container {
          grid-template-columns: repeat(3, 1fr); /* Three columns for larger screens */
        }
      }
      @media (min-width: 1300px) {
        .tile-container {
          grid-template-columns: repeat(4, 1fr);
        }
      }
      .tile {
        font-family: 'IBM Plex Serif', serif;
        background: var(--surface);
        border: 1px solid var(--surface-border);
        border-radius: var(--radius-1);
        padding: var(--space-3);
        overflow-x: auto;
        max-width: 100%;
        box-shadow: 0 4px 8px rgba(0,0,0,0.15); /* Enhance visibility */
        text-align: left;
      }
.tile:hover{ box-shadow:0 4px 12px rgba(0,0,0,.08); }
      .tile h1, .tile h2 {
        margin-top: 0;
        color:var(--text-primary);
      }

/* Modern heading typography */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Roboto Slab', serif;
  color: var(--text-primary);
  margin: 1.2em 0 0.6em;
  line-height: 1.2;
  font-weight: 600;
}

h1 {
  font-size: 2.5rem;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 2rem;
  letter-spacing: -0.015em;
  border-bottom: 2px solid #ddd;
  padding-bottom: 0.3em;
}

h3 {
  font-size: 1.75rem;
  letter-spacing: -0.01em;
}

h4 {
  font-size: 1.5rem;
}

h5 {
  font-size: 1.25rem;
}

h6 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
      .day-block {
        display:inline-block;
        width:10px;
        height:10px;
        margin:1px;
        border-radius:2px;
        box-shadow:0 0 2px rgba(0,0,0,.45);
        transition:transform .2s ease;
        cursor:pointer;
      }
      .day-block:hover { transform:scale(1.4); }
      .seedling { background-color: lightgreen; }
      .vegetation { background-color: green; }
      .bloom { background-color: yellowgreen; }
      .flushing { background-color: blue; }
      .today {
        border: 2px solid red;
        background-color: aqua;
        width: 10px;
        height: 10px;
      }
      #growProgress #progress-bar { display:flex; flex-wrap:wrap; justify-content:center; margin-bottom:6px; }
      #growProgress .legend { margin-bottom:6px; }
      #growProgress .legend-item { display:inline-flex; align-items:center; margin-right:4px; color:var(--text-secondary); font-size:.8rem; }
      #growProgress .legend-color { width:12px; height:12px; border-radius:2px; margin-right:4px; }
      #growProgress .progress-summary { font-size:.85rem; text-align:center; }
      .average-display {
        margin-top: 10px;
        font-weight: bold;
        text-align: center;
        background:rgba(109, 102, 102, 0.8);
        padding: 10px;
        border-radius: 5px;
        width: 90%;
      }
      .camera-feeds {
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-top: 20px;
      }
      .camera-feeds img {
        max-width: 100%;
        height: auto;
        border: 2px solid #ccc;
        border-radius: 10px;
      }
      .button-image {
        margin: 5px;
      }
        .button-image :is(img, svg, lottie-player, .lottie) {
          width: 50px;
          height: 50px;
          border-radius: 50%;
          transition: transform 0.3s ease, box-shadow 0.3s ease;
        }
        .button-image :is(img, svg, lottie-player, .lottie):hover {
          transform: scale(1.1);
          box-shadow: 0 0 10px var(--success-600);
        }
        .menu-links a.active {
          border: 2px solid var(--brand-600);
          box-shadow: 0 0 10px var(--brand-600);
          border-radius: 50%;
        }
        body.dark-mode .menu-links a.active {
          filter: none;
        }
        body.dark-mode .menu-links a.active :is(img, svg, lottie-player, .lottie) {
          filter: none;
        }
        .markdown-style {
          white-space: pre-wrap;
          font-family: 'IBM Plex Serif', serif;
        }
      .device-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
        gap: 10px;
        text-align: center;
        margin-bottom: 20px;
      }
      .device-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
      }
      .device-item img {
        margin-bottom: 5px;
      }
      
      .device-label {
        font-size: 0.9em;
      }
      .device-icon.on {
        border: 2px solid #00c853;
        border-radius: 50%;
      }
      .device-icon.off {
        border: 2px solid #ccc;
        border-radius: 50%;
      }
      .device-icon.error {
        border: 2px solid #ff5722;
        border-radius: 50%;
      }
      .device-item.problem {
        box-shadow: 0 0 10px 2px #ff5722;
        border-radius: 8px;
      }
      .radio-container {
        margin-bottom: 20px;
      }
      .trend,
      .trend-arrow {
        font-size: 1.2em;
        margin-left: 4px;
        transition: color .3s ease, transform .3s ease;
      }
      .trend-up   { color:#00c853; transform: translateY(-1px); }  /* green ↑ */
      .trend-down { color:#d50000; transform: translateY( 1px); }  /* red   ↓ */
      .trend-stable { color:#999; }
      .data-line {
        display: flex;
        align-items: center;
        margin: 5px 0;
      }
      .data-line strong {
        margin-right: 5px;
      }
      .data-line span {
        margin-right: 5px;
      }
      /* ───── Generic “informational” blue ───── */
  .device-icon.info {
    border: 2px solid #2196f3;
    border-radius: 50%;
  }

/* ───── Phase colours (match grow-tracker blocks) ───── */
.device-icon.seedling   { }
.device-icon.vegetation { }
.device-icon.bloom      { }
.device-icon.flushing   { }

/* Fert-Today line must not “explode” the layout                */
#metricFertToday.metric-value{
  font-size:0.9rem;               /* a tad smaller               */
  max-width:80px;                 /* never wider than DLI tile   */
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

      .trend-arrow,
      #vpdTrendArrow,
      #humidityTrendArrow,
      #temperatureTrendArrow { transition: color .3s ease; }

/* Modern form fields */
input[type="text"],
input[type="number"],
input[type="datetime-local"],
textarea,
select {
  padding: 0.6em 1em;
  border: none;
  border-radius: 0.5em;
  background: #f0f0f5;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
  font-size: 1rem;
  transition: box-shadow 0.3s ease, background 0.3s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="datetime-local"]:focus,
textarea:focus,
select:focus {
  outline: none;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(0, 150, 255, 0.5);
}

/* Modern buttons */
button,
input[type="submit"],
input[type="button"] {
  padding: 0.6em 1.2em;
  background: linear-gradient(135deg, #00c853 0%, #007a33 100%);
  color: #ffffff;
  border: none;
  border-radius: 0.5em;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover,
input[type="submit"]:hover,
input[type="button"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

button:active,
input[type="submit"]:active,
input[type="button"]:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
    /* ─── Refresh‑indicator ─────────────────────────────── */
    .device-item {                   /* allow overlay positioning */
      position: relative;
    }

    @keyframes flashRefresh {
      0%   { opacity: 0; transform: scale(0.4); }
      10%  { opacity: 1; transform: scale(1.2); }
      90%  { opacity: 1; transform: scale(1);   }
      100% { opacity: 0; transform: scale(0.4); }
    }
    .refresh-indicator {
      position: absolute;
      top: -6px;
      left: -6px;
      font-size: 1.1rem;
      line-height: 1;
      color: #007a33;          /* corporate green */
      pointer-events: none;
      animation: flashRefresh 0.8s ease-out forwards;
      text-shadow: 0 0 2px #0008;
    }

    @keyframes flashBg {
      from { background-color: rgba(255,255,255,0.8); }
      to   { background-color: var(--surface); }
    }

    .flash-refresh {
      animation: flashBg 0.8s ease-out;
    }
/* ─── Touch‑friendly overrides (2025) ─────────────────────────── */
:root{
  --nav-btn-size:72px;                       /* bigger hit area   */
}

/* make the whole nav row scrollable on narrow screens */
.navbar{
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:none;          /* Firefox */
}
.navbar::-webkit-scrollbar{display:none;}    /* WebKit */

.navbar a{
  flex:0 0 auto;                 /* never shrink */
  width:var(--nav-btn-size);
  height:var(--nav-btn-size);
  margin:0 4px;
  touch-action:manipulation;     /* better mobile feedback */
  border-radius:20%;             /* softened circle */
}

/* Tap ripple */
@keyframes rip{from{transform:scale(0);opacity:.5}to{transform:scale(2);opacity:0}}
.navbar a:active::before{
  content:'';
  position:absolute;
  inset:0;
  border-radius:inherit;
  background:rgba(255,255,255,.35);
  animation:rip .6s ease-out;
  pointer-events:none;
}

/* Active/hover tweaks (keeps previous lift‑up) */
.navbar a:active{transform:scale(.94);}
.navbar a:hover::after,
.navbar a:focus-visible::after{opacity:1;}

/* Focus ring for keyboard users */
.navbar a:focus-visible{
  outline:2px solid #0af;
  outline-offset:4px;
}

/* Icon padding so fingers don’t cover the graphic completely */
.navbar img{
  padding:6px;
  object-fit:contain;
}

/* Bigger brand logos for visual balance */
.brand-header .brand-logo{
  width:72px;
  height:72px;
}

    /* ─── Modern Grow‑Tiles (DLI / Nutrient / Growth Tracker) ─── */
.dli-card,
.nutri-grid         { display:grid; gap:8px; padding:12px;
                      border-radius:8px; background:#f7f7f7; }

.dli-phase,
.dli-week           { font-weight:600; }

.dli-gauge          { position:relative; height:12px; border-radius:6px;
                      background:#e0e0e0; overflow:hidden; }
.dli-bar            { position:absolute; inset:0;
                      background:linear-gradient(90deg,#00c853,#aeea00); }
.dli-value          { font-size:.9rem; margin-top:4px; display:inline-block; }

.nutri-grid         { grid-template-columns:repeat(auto-fit,minmax(120px,1fr)); }
.nutri-item         { text-align:center; background:#ffffffaa; border-radius:6px; padding:8px; }
.nutri-label        { display:block; font-size:.8rem; color:#555; }
.nutri-value        { font-size:1.1rem; font-weight:700; }

.booster-bubble    { display:inline-block; padding:var(--space-1) var(--space-2);
                      border:1px solid var(--brand-600); border-radius:var(--radius-1);
                      margin:var(--space-1); font-size:.85rem; }

/* Dark theme colours for nutrient grid and booster bubbles */
body.dark-mode .nutri-grid {
  background:#1a3328;
  color:var(--text-primary);
}
body.dark-mode .nutri-item {
  background:#1e4d3d;
}
body.dark-mode .booster-bubble {
  background:#255d46;
  color:var(--text-primary);
}
body.dark-mode .nutri-grid .nutri-label,
body.dark-mode .nutri-grid .nutri-value {
  color:var(--text-primary);
}
/* Ensure good contrast on light cards when dark mode is enabled */
body.dark-mode .dli-card {
  color:#000;
}

.growth-tile .progress-bar-horizontal { display:flex; height:12px;
                                        border-radius:6px; overflow:hidden;
                                        margin-bottom:8px; }
.progress-segment.seedling   { background:lightgreen; }
.progress-segment.vegetation { background:green; }
.progress-segment.bloom      { background:yellowgreen; }
.progress-segment.flushing   { background:cornflowerblue; }
.progress-segment.today      { outline:2px solid red; outline-offset:-2px; }

.progress-info      { font-size:.9rem; text-align:center; }
/* ────────────────────────────────────────────────
   Typography & Spacing Patch (June 2025)
   – IBM Plex Serif everywhere
   – Balanced heading scale
   – Uniform metric text
   – Tidy, evenly‑spaced tiles
   ──────────────────────────────────────────────── */
body,
button,
input,
select,
textarea,
.metric-label,
.metric-value {
  font-family: 'IBM Plex Serif', serif !important;
}

/* Balanced “perfect‑fourth” heading cascade */
h1 { font-size: 2.488rem; line-height: 1.15; font-weight: 700; }
h2 { font-size: 1.990rem; line-height: 1.20; font-weight: 700; }
h3 { font-size: 1.592rem; line-height: 1.25; font-weight: 700; }
h4 { font-size: 1.274rem; line-height: 1.30; font-weight: 700; }
h5 { font-size: 1.019rem; line-height: 1.35; font-weight: 700; }
h6 { font-size: 0.815rem; line-height: 1.40; font-weight: 700; }
h1, h2, h3, h4, h5, h6 {
  margin: 0.8em 0 0.4em;
  font-family: 'IBM Plex Serif', serif !important;
}

/* Uniform metric read‑outs */
.metric-value {
  font-size: 1.05rem;
  font-weight: 700;
}
.metric-label,
.device-label {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
}

/* Tidy tile rhythm */
.tile {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: 1.3rem 1.3rem 1.6rem;
}
.tile > *:last-child { margin-bottom: 0; }

/* Harmonise internal grid gaps */
.device-grid,
.nutri-grid,
.vpd-grid {
  gap: 1rem !important;
}
/* ───────────────────────────────────────────────────────────── */
/* END NEW STYLES */
/* ============================================================ */
      .ref-photo { width:120px; border-radius:6px; }

/* ----------------- Diary Timeline Styles ------------------ */
.diary-timeline {
  max-height: 400px;
  overflow-y: auto;
  border-left: 3px solid var(--brand-600);
  padding-left: 1rem;
}
.diary-entry {
  position: relative;
  margin-bottom: 1rem;
}
.diary-entry::before {
  content: '';
  position: absolute;
  left: -0.65rem;
  top: 0.25rem;
  width: 0.8rem;
  height: 0.8rem;
  background: var(--brand-600);
  border-radius: 50%;
}
.diary-entry .entry-date {
  font-weight: 600;
  margin-bottom: 0.2rem;
}
.diary-entry p {
  margin: 0.2rem 0;
}
/* ----------------------------------------------------------- */

/* Dark mode toggle switch */
.theme-switch{
  position:relative;
  display:inline-block;
  width:50px;
  height:24px;
}
.theme-switch input{
  opacity:0;
  width:0;
  height:0;
}
.theme-switch .slider{
  position:absolute;
  cursor:pointer;
  top:0;
  left:0;
  right:0;
  bottom:0;
  background-color:#ccc;
  transition:.4s;
  border-radius:34px;
}
.theme-switch .slider:before{
  position:absolute;
  content:"";
  height:18px;
  width:18px;
  left:3px;
  bottom:3px;
  background-color:white;
  transition:.4s;
  border-radius:50%;
}
.theme-switch input:checked + .slider{
  background-color:var(--brand-600);
}
.theme-switch input:checked + .slider:before{
  transform:translateX(26px);
}

.language-switch-wrapper select{
  appearance:none;
  background-color:var(--brand-600);
  color:#fff;
  border:none;
  padding:0.25rem 1.5rem 0.25rem 0.5rem;
  border-radius:4px;
  cursor:pointer;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='1.5' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position:right 0.5rem center;
  background-size:0.65rem;
}

.language-switch-wrapper select:focus{
  outline:2px solid var(--brand-600);
}

/* ---------- Menu bar layout ---------- */
#menu-bar{
  display:flex;
  flex-wrap:nowrap;
  align-items:center;
  gap:1rem;
  text-align:left;
  width:100%;
  padding:0.5rem 1rem;
  position:sticky;
  top:0;
  z-index:100;
  background:rgba(255,255,255,0.6);
  border:1px solid var(--surface-border);
  backdrop-filter:blur(10px);
  border-radius:var(--radius-1);
  box-shadow:0 4px 12px rgba(0,0,0,0.08);
  overflow:visible; /* ensure icon glows aren't clipped */
}
body.dark-mode #menu-bar{
  background:rgba(15,29,20,0.6);
  border-color:#173b2f;
  box-shadow:0 4px 12px rgba(0,0,0,0.4);
}
#menu-bar .logo{
  height:60px;
  width:auto;
  display:block;
  flex:0 0 auto;
}
#menu-bar.small .logo{
  height:50px;
}
#menu-bar .menu-content{
  display:flex;
  flex-direction:column;
  gap:0.5rem;
  flex:1 1 auto;
  min-width:0;
}
.menu-topbar{
  display:flex;
  width:100%;
  justify-content:flex-end;
  align-items:center;
  gap:0.85rem;
  flex-wrap:wrap;
}
#menu-bar .menu-links{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:1rem;
  flex-wrap:nowrap;
  max-width:100%;
  /* Allow vertical overflow so tooltips or labels can extend
     outside the menu item grid without being clipped. Enable horizontal scrolling on narrow screens without showing scrollbars. */
  overflow:visible;
  overflow-x:auto;
  scrollbar-width:none; /* Firefox */
  -ms-overflow-style:none; /* IE 10+ */
}
#menu-bar .menu-links::-webkit-scrollbar{
  display:none;
}
#menu-bar .menu-links .button-image{
  display:flex;
  align-items:center;
  justify-content:center;
  width:104px;
  height:104px;
  border-radius:50%;
  overflow:visible; /* allow icon glow to extend beyond the circle */
  transition:transform 0.2s;
  position:relative;
  box-sizing:border-box;
  background:rgba(255,255,255,0.35);
  backdrop-filter:blur(6px);
  border:1px solid rgba(255,255,255,0.3);
  box-shadow:0 2px 6px rgba(0,0,0,0.1);
  color:rgba(24,74,56,0.9);
}
body.dark-mode #menu-bar .menu-links .button-image{
  background:rgba(15,29,20,0.45);
  border:1px solid rgba(255,255,255,0.1);
  box-shadow:0 2px 6px rgba(0,0,0,0.6);
  color:#f0faf3;
}
#menu-bar .menu-links .button-image :is(img, svg, lottie-player, .lottie){
  width:80px;
  height:80px;
  border-radius:50%;
  transition:transform 0.2s;
}
#menu-bar .menu-links .button-image:hover{
  transform:scale(1.05);
}
#menu-bar .menu-links .button-image:hover :is(img, svg, lottie-player, .lottie){
  transform:scale(1.1);
}

#menu-bar .menu-links .button-image[data-tooltip]::after{
  content:attr(data-tooltip);
  position:absolute;
  bottom:110%;
  left:50%;
  transform:translateX(-50%);
  background:rgba(0,0,0,0.45);
  color:#fff;
  padding:4px 8px;
  border-radius:8px;
  white-space:nowrap;
  opacity:0;
  pointer-events:none;
  transition:opacity 0.2s;
  z-index:10;
  backdrop-filter:blur(4px);
}

#menu-bar .menu-links .button-image:hover::after,
#menu-bar .menu-links .button-image:focus::after{
  opacity:1;
}

#menu-bar.menu-compact .menu-links{
  flex-wrap:wrap;
  justify-content:center;
}
#menu-bar.menu-compact .menu-links .button-image{
  width:84px;
  height:84px;
}
#menu-bar.menu-compact .menu-links .button-image :is(img, svg, lottie-player, .lottie){
  width:60px;
  height:60px;
}

#menu-bar.menu-tiny .menu-links{
  flex-wrap:wrap;
  justify-content:center;
}
#menu-bar.menu-tiny .menu-links .button-image{
  width:72px;
  height:72px;
}
#menu-bar.menu-tiny .menu-links .button-image :is(img, svg, lottie-player, .lottie){
  width:48px;
  height:48px;
}

.account-menu{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
}
.account-toggle{
  appearance:none;
  -webkit-appearance:none;
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  width:64px;
  height:64px;
  padding:0;
  margin:0;
  border-radius:50%;
  cursor:pointer;
  background:rgba(255,255,255,0.5);
  border:1px solid rgba(255,255,255,0.4);
  box-shadow:0 4px 12px rgba(0,0,0,0.12);
  backdrop-filter:blur(10px);
}
body.dark-mode .account-toggle{
  background:rgba(15,29,20,0.55);
  border-color:rgba(255,255,255,0.12);
  box-shadow:0 4px 12px rgba(0,0,0,0.5);
}
.account-toggle-logo{
  width:42px;
  height:42px;
  object-fit:contain;
}
.account-toggle[data-tooltip]::after{
  content:attr(data-tooltip);
  position:absolute;
  bottom:115%;
  left:50%;
  transform:translateX(-50%);
  background:rgba(0,0,0,0.45);
  color:#fff;
  padding:4px 8px;
  border-radius:8px;
  white-space:nowrap;
  opacity:0;
  pointer-events:none;
  transition:opacity 0.2s;
  z-index:10;
  backdrop-filter:blur(4px);
}
.account-toggle:hover::after,
.account-toggle:focus::after{
  opacity:1;
}
.account-dropdown{
  position:absolute;
  top:calc(100% + 0.75rem);
  right:0;
  min-width:260px;
  padding:0.7rem;
  display:flex;
  flex-direction:column;
  gap:0.45rem;
  border-radius:22px;
  background:rgba(255,255,255,0.92);
  border:1px solid rgba(255,255,255,0.6);
  box-shadow:0 18px 42px rgba(13,27,19,0.18);
  backdrop-filter:blur(14px);
  z-index:130;
}
body.dark-mode .account-dropdown{
  background:rgba(15,29,20,0.94);
  border-color:rgba(255,255,255,0.08);
  box-shadow:0 18px 42px rgba(0,0,0,0.45);
}
body:not(.dark-mode) #menu-bar{
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(244, 250, 246, 0.94)),
    var(--surface-strong);
  border-color:rgba(23,111,63,0.14);
  box-shadow:0 24px 56px rgba(21,45,31,0.14);
}
body:not(.dark-mode) #menu-bar .logo,
body:not(.dark-mode) #menu-bar .menu-links .button-image,
body:not(.dark-mode) .account-toggle{
  background:rgba(255,255,255,0.82);
  border-color:rgba(23,111,63,0.14);
  box-shadow:
    0 12px 28px rgba(21,45,31,0.12),
    inset 0 1px 0 rgba(255,255,255,0.58);
}
body:not(.dark-mode) #menu-bar .menu-links .button-image:hover,
body:not(.dark-mode) .account-toggle:hover,
body:not(.dark-mode) .account-toggle:focus{
  background:rgba(255,255,255,0.96);
}
body:not(.dark-mode) #menu-bar .menu-links .button-image.active,
body:not(.dark-mode) #menu-bar .menu-links .button-image.active:hover{
  background:
    linear-gradient(180deg, rgba(121, 225, 151, 0.42), rgba(52, 165, 96, 0.26)),
    rgba(255,255,255,0.96);
  border-color:rgba(32,155,86,0.42);
  box-shadow:
    0 18px 36px rgba(32,155,86,0.22),
    inset 0 0 0 1px rgba(255,255,255,0.48),
    inset 0 1px 0 rgba(255,255,255,0.54);
  color:#166b45;
}
body:not(.dark-mode) .account-dropdown{
  background:rgba(255,255,255,0.97);
  border-color:rgba(23,111,63,0.12);
  box-shadow:0 24px 48px rgba(13,27,19,0.16);
}
body:not(.dark-mode) .account-menu-icon{
  background:rgba(32,155,86,0.14);
}
.account-menu:not(.open) .account-dropdown{
  display:none;
}
.account-menu-setting,
.account-menu-action{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  width:100%;
  gap:0.85rem;
  padding:0.8rem 0.9rem;
  border:0;
  border-radius:12px;
  background:transparent;
  color:var(--text-primary);
  text-decoration:none;
  font:inherit;
  cursor:pointer;
}
.account-menu-setting{
  cursor:default;
  padding-right:0.5rem;
}
.account-menu-copy{
  display:flex;
  flex:1 1 auto;
  align-items:center;
  min-width:0;
}
.account-menu-title{
  font-size:0.96rem;
  font-weight:600;
  line-height:1.2;
}
.account-menu-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:2.2rem;
  height:2.2rem;
  flex:0 0 2.2rem;
  border-radius:999px;
  background:rgba(62,138,90,0.12);
  color:var(--brand-700);
}
.account-menu-icon svg{
  width:1.1rem;
  height:1.1rem;
  stroke:currentColor;
  stroke-width:1.75;
  fill:none;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.account-menu-switch{
  flex:0 0 auto;
}
.account-language-switch-wrapper{
  flex:0 0 auto;
}
.account-language-switch-wrapper select{
  min-width:4.9rem;
  padding:0.45rem 1.9rem 0.45rem 0.75rem;
  border-radius:999px;
  border:1px solid rgba(62,138,90,0.18);
  background-color:rgba(62,138,90,0.1);
  color:var(--text-primary);
  font-weight:600;
}
.account-language-switch-wrapper select:focus{
  outline:2px solid rgba(62,138,90,0.25);
  outline-offset:2px;
}
.account-dropdown-divider{
  height:1px;
  margin:0.1rem 0 0.15rem;
  background:rgba(95,107,99,0.15);
}
.account-menu-action:hover,
.account-menu-action:focus{
  background:rgba(62,138,90,0.12);
}
body.dark-mode .account-menu-icon{
  background:rgba(62,138,90,0.18);
  color:#d9f7dc;
}
body.dark-mode .account-language-switch-wrapper select{
  border-color:rgba(217,247,220,0.14);
  background-color:rgba(62,138,90,0.16);
  color:#f4fff5;
}
body.dark-mode .account-dropdown-divider{
  background:rgba(217,247,220,0.12);
}
.account-dialog{
  width:min(460px, calc(100vw - 2rem));
  max-width:100%;
  padding:0;
  border:0;
  background:transparent;
}
.account-dialog::backdrop{
  background:rgba(12,18,14,0.42);
  backdrop-filter:blur(8px);
}
.account-dialog-card{
  position:relative;
  display:flex;
  flex-direction:column;
  gap:0.85rem;
  padding:1.5rem;
  border-radius:24px;
  background:var(--surface);
  border:1px solid var(--surface-border);
  box-shadow:0 22px 50px rgba(13,27,19,0.18);
}
body.dark-mode .account-dialog-card{
  border-color:#173b2f;
  box-shadow:0 22px 50px rgba(0,0,0,0.45);
}
.account-dialog-close{
  position:absolute;
  top:1rem;
  right:1rem;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:2.2rem;
  height:2.2rem;
  border:0;
  border-radius:999px;
  background:rgba(62,138,90,0.12);
  color:var(--text-primary);
  font-size:1.2rem;
  cursor:pointer;
}
.account-dialog-logo{
  width:92px;
  height:auto;
  margin:0 auto 0.25rem;
}
.account-dialog-title{
  margin:-0.25rem 0 0;
  text-align:center;
  color:var(--text-muted, #5f6b63);
}
.account-details{
  display:grid;
  gap:0;
  margin:0;
}
.account-details div{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:1rem;
  padding:0.85rem 0;
  border-top:1px solid var(--surface-border);
}
.account-details dt{
  font-size:0.78rem;
  font-weight:700;
  letter-spacing:0.06em;
  text-transform:uppercase;
  color:var(--text-muted, #5f6b63);
}
.account-details dd{
  margin:0;
  text-align:right;
  font-weight:600;
  color:var(--text-primary);
  word-break:break-word;
}
.account-passkeys{
  margin-top:0.35rem;
  padding-top:1rem;
  border-top:1px solid var(--surface-border);
}
.account-passkeys-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:1rem;
  flex-wrap:wrap;
}
.account-passkeys-head h3{
  margin:0;
}
.account-passkey-count{
  font-size:0.9rem;
  color:var(--text-muted, #5f6b63);
}
.account-passkey-button{
  width:100%;
  margin-top:0.85rem;
}
.account-passkey-status{
  margin:0.75rem 0 0;
  min-height:1.35rem;
  font-size:0.92rem;
  color:var(--text-muted, #5f6b63);
}
.account-passkey-status.error{
  color:var(--danger-600);
}
.account-passkey-status.success{
  color:var(--success-600, #1f7a4d);
}

@media (max-width: 1000px){
  #menu-bar .menu-links{
    flex-wrap:wrap;
    justify-content:center;
  }
  #menu-bar .menu-links .button-image{
    width:84px;
    height:84px;
  }
  #menu-bar .menu-links .button-image :is(img, svg, lottie-player, .lottie){
    width:60px;
    height:60px;
  }
}

@media (max-width: 600px){
  #menu-bar{
    flex-direction:column;
    align-items:center;
    gap:0.5rem;
  }
  #menu-bar .menu-content{
    width:100%;
  }
  .menu-topbar{
    width:100%;
    align-items:center;
    justify-content:flex-end;
  }
  #menu-bar .menu-links{
    flex-wrap:wrap;
    justify-content:center;
  }
  #menu-bar .menu-links .button-image{
    width:72px;
    height:72px;
  }
  #menu-bar .menu-links .button-image :is(img, svg, lottie-player, .lottie){
    width:48px;
    height:48px;
  }
  .account-dropdown{
    right:50%;
    transform:translateX(50%);
    min-width:min(92vw, 320px);
  }
  .account-details div{
    flex-direction:column;
  }
  .account-details dd{
    text-align:left;
  }
}

/* Ensure Google charts have transparent row backgrounds in all themes */
.google-visualization-timeline rect[fill="#ffffff"],
.google-visualization-timeline rect[fill="#fff"],
.google-visualization-timeline rect[fill="#e5e5e5"],
.google-visualization-timeline rect[fill="#e6e6e6"],
.google-visualization-timeline rect[fill="#f5f5f5"],
.google-visualization-timeline rect[fill="#f8f9fa"],
.google-visualization-timeline rect[fill="#fafafa"],
.google-visualization-timeline rect[fill="#f0f0f0"]{
  fill:transparent;
}
.google-visualization-timeline text{
  fill:var(--text-primary);
}

/* Settings page enhancements */
.collapsible {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.toggle-icon {
  font-size: 0.9em;
}
.help-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 1.15rem;
  block-size: 1.15rem;
  border-radius: 999px;
  cursor: pointer;
  margin-left: 0.25rem;
  color: var(--brand-600);
  background: rgba(87, 114, 97, 0.12);
  font-size: 0.78rem;
  font-weight: 700;
  vertical-align: middle;
}

.help-icon::before,
.help-icon::after {
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 20;
}

.help-icon::before {
  content: "";
  border: 6px solid transparent;
  border-top-color: rgba(245, 242, 236, 0.98);
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translate(-50%, 6px);
}

.help-icon::after {
  content: attr(data-tippy-content);
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translate(-50%, 8px);
  min-width: 11rem;
  max-width: min(18rem, 65vw);
  padding: 0.6rem 0.75rem;
  border: 1px solid rgba(32, 44, 39, 0.14);
  border-radius: 0.85rem;
  background: rgba(245, 242, 236, 0.98);
  box-shadow: 0 14px 28px rgba(32, 44, 39, 0.18);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
}

.help-icon:hover::before,
.help-icon:hover::after,
.help-icon:focus-visible::before,
.help-icon:focus-visible::after,
.help-icon.is-active::before,
.help-icon.is-active::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.help-icon:focus-visible {
  outline: 2px solid rgba(87, 114, 97, 0.35);
  outline-offset: 2px;
}

/* grouped settings sections */
.settings-group {
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-1);
  padding: var(--space-2);
  margin-bottom: var(--space-3);
}

.settings-group legend {
  font-weight: 600;
}

.save-btn {
  display: block;
  margin-left: auto;
  margin-top: var(--space-2);
}

.test-btn {
  margin-top: var(--space-1);
}

.chart-zoom-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-zoom-overlay > div {
  width: 90%;
  height: 90%;
}

.chart-zoomable {
  cursor: zoom-in;
}

.ai-metrics-table {
  width: 100%;
  border-collapse: collapse;
}
.ai-metrics-table th,
.ai-metrics-table td {
  border: 1px solid var(--surface-border);
  padding: 4px 6px;
  text-align: left;
}

.skeleton {
  background: linear-gradient(90deg, #eee, #ddd, #eee);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  width: 100%;
  min-height: 1em;
  border-radius: 4px;
}

.updated-at.skeleton {
  display: none;
}

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

.why-link {
  font-size: 0.8em;
  margin-left: var(--space-1);
  color: var(--text-secondary);
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
}

.explain-popover {
  display: none;
  position: fixed;
  top: var(--space-3);
  right: var(--space-3);
  max-width: 240px;
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-1);
  padding: var(--space-2);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  z-index: 1000;
}

.explain-popover.open {
  display: block;
}

/* Toast notifications */
.toast-container {
  position: fixed;
  bottom: var(--space-3);
  right: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  z-index: 10000;
}

.toast {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-1);
  padding: var(--space-2);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
}

.toast-info {
  border-left: 4px solid var(--brand-600);
}

.toast-warning {
  border-left: 4px solid #b30000;
}

.toast-critical {
  border-left: 4px solid var(--danger-600);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.hide {
  opacity: 0;
  transform: translateY(10px);
}

.toast button {
  margin-left: var(--space-2);
}

body.loading {
  overflow: hidden;
}

body.loading .tile-container {
  display: none;
}

body.loading #menu-bar {
  display: none;
}

lottie-player,
.lottie {
  display: block;
  margin: 0 auto;
}

/* ---------------- Settings page styles ---------------- */
.settings-form label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-top: var(--space-2);
  margin-bottom: var(--space-1);
  font-weight: 600;
  word-break: break-word;
}

.settings-form input,
.settings-form select {
  margin-top: var(--space-1);
  margin-bottom: var(--space-2);
  width: 100%;
  box-sizing: border-box;
}

.settings-form button {
  margin-top: var(--space-1);
  margin-bottom: var(--space-2);
}

.pid-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.pid-form h3 {
  margin-bottom: var(--space-2);
}

.pid-form button,
.pid-form input {
  margin-top: var(--space-1);
  margin-bottom: var(--space-2);
}

.user-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.user-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.user-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.user-item form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
  margin: 0;
}

.tile h2,
.tile h3 {
  margin-top: 0;
  margin-bottom: var(--space-2);
}

/* ----- update overlay ----- */
body.no-scroll {
  overflow: hidden;
}
.update-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 1000;
}
.update-overlay.hidden {
  display: none;
}
.update-card {
  background: #fff;
  padding: 2rem;
  border-radius: 12px;
  text-align: center;
  width: min(90%, 600px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  position: relative;
}
#updateSteps {
  max-height: 60vh;
  overflow-y: auto;
  text-align: left;
}
.update-step pre {
  max-height: 200px;
  overflow-y: auto;
}
.update-close {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  z-index: 1001;
}
.update-step {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.update-step pre {
  flex-basis: 100%;
}
.update-card .anim {
  width: 80px;
  height: 80px;
  margin: 0 auto;
}

.update-step .anim {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.update-step.ok span {
  color: #2e7d32;
}

.update-step.fail span {
  color: #c62828;
}

.update-step.fail .anim {
  color: #c62828;
}

#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  z-index: 9999;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 220ms ease, visibility 220ms ease;
}

#loading-overlay img {
  width: 120px;
  height: auto;
}

#loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Grow calendar grid */
.calendar-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}
.calendar-summary {
  margin: 0.35rem 0 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  color: var(--text-muted, #5f6b63);
}
.calendar-summary-days {
  font-weight: 700;
  color: var(--text-primary);
}
.calendar-summary-range {
  font-size: 0.95rem;
}
.calendar-pagination {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.5rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  background: rgba(255,255,255,0.72);
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
}
body.dark-mode .page-link {
  background: rgba(15,29,20,0.65);
  border-color: #173b2f;
}
.page-link.is-disabled {
  opacity: 0.45;
  cursor: default;
}
.page-status {
  font-weight: 700;
  color: var(--text-primary);
}
.calendar-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-start;
}
.calendar-day {
  position: relative;
  width: 80px;
  height: 80px;
  overflow: hidden;
  border-radius: 4px;
  cursor: pointer;
}
.calendar-day video,
.calendar-day .no-video,
.calendar-day img {
  width: 90%;
  height: 90%;
  margin: 5%;
  object-fit: cover;
  display: block;
}
.calendar-day video { opacity: 0.85; }
.calendar-thumb-video {
  position: absolute;
  inset: 5%;
  margin: 0;
  z-index: 2;
  border-radius: 4px;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.18s ease;
}
.calendar-day.preview-active .calendar-thumb-video,
.calendar-day.video-ready .calendar-thumb-video {
  opacity: 0;
}
.calendar-day.video-unavailable video {
  display: none;
}
.calendar-day .no-video {
  background: #ccc;
  border-radius: 4px;
}
.thumb-date {
  position: absolute;
  top: 2px;
  left: 2px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  padding: 1px 3px;
  font-size: 12px;
  border-radius: 2px;
}
.thumb-day {
  position: absolute;
  right: 2px;
  bottom: 2px;
  background: rgba(255,255,255,0.78);
  color: #142117;
  padding: 1px 4px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
}
body.dark-mode .thumb-day {
  background: rgba(15,29,20,0.82);
  color: #eef9f1;
}
.calendar-day img { opacity: 0.85; }
.calendar-day.S1, .day-block.S1, .legend-color.S1 { background: #e8f5e9; }
.calendar-day.S2, .day-block.S2, .legend-color.S2 { background: #c8e6c9; }
.calendar-day.S3, .day-block.S3, .legend-color.S3 { background: #a5d6a7; }
.calendar-day.S4, .day-block.S4, .legend-color.S4 { background: #81c784; }
.calendar-day.S5, .day-block.S5, .legend-color.S5 { background: #66bb6a; }
.calendar-day.S6, .day-block.S6, .legend-color.S6 { background: #dce775; }
.calendar-day.S7, .day-block.S7, .legend-color.S7 { background: #fff176; }
.calendar-day.S8, .day-block.S8, .legend-color.S8 { background: #ffd54f; }
.calendar-day.S9, .day-block.S9, .legend-color.S9 { background: #ffb74d; }
.calendar-day.S10, .day-block.S10, .legend-color.S10 { background: #ff8a65; }
.calendar-day.S11, .day-block.S11, .legend-color.S11 { background: #f4511e; }
.legend { margin-top: 6px; }
.legend-item { display:inline-flex; align-items:center; margin-right:4px; color:var(--text-secondary); font-size:.8rem; }
.legend-color { width:12px; height:12px; border-radius:2px; margin-right:4px; }
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal.hidden { display: none; }
.modal-content video {
  max-width: 90vw;
  max-height: 90vh;
}
.modal-content img {
  max-width: 90vw;
  max-height: 90vh;
}

@media (max-width: 700px) {
  .calendar-toolbar {
    align-items: stretch;
  }
  .calendar-pagination {
    width: 100%;
    justify-content: space-between;
  }
  .page-link {
    min-width: 4.5rem;
  }
}

/* ---------------- Fermentic brand refresh ---------------- */
:root {
  --font-ui: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'IBM Plex Serif', Georgia, serif;
  --page-max-width: 1680px;
  --space-edge: clamp(10px, 1.25vw, 18px);
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: rgba(255, 255, 255, 0.96);
  --surface-border: rgba(23, 67, 45, 0.18);
  --surface-soft: rgba(255, 255, 255, 0.76);
  --body-bg: #e5eee6;
  --body-bg-strong: #d5e2d8;
  --text-primary: #102018;
  --text-secondary: #40564a;
  --text-muted: #62786c;
  --brand-400: #7ee89a;
  --brand-500: #42cf73;
  --brand-600: #209b56;
  --brand-700: #176f3f;
  --shadow-card: 0 24px 60px rgba(21, 45, 31, 0.16);
  --shadow-menu: 0 24px 56px rgba(21, 45, 31, 0.18);
  --radius-1: 18px;
  --radius-card: 26px;
  --radius-pill: 999px;
  color-scheme: light;
}

body.dark-mode {
  --surface: rgba(8, 21, 15, 0.74);
  --surface-strong: rgba(11, 27, 19, 0.92);
  --surface-border: rgba(155, 205, 175, 0.14);
  --surface-soft: rgba(17, 37, 27, 0.72);
  --body-bg: #06110c;
  --body-bg-strong: #0d1a13;
  --text-primary: #edf8f0;
  --text-secondary: #bccfc2;
  --text-muted: #8aa091;
  --brand-400: #93f0a7;
  --brand-500: #55d884;
  --brand-600: #31b86a;
  --brand-700: #219455;
  --success-600: #7df0a2;
  --danger-600: #ff8f8b;
  --shadow-card: 0 30px 80px rgba(0, 0, 0, 0.46);
  --shadow-menu: 0 22px 60px rgba(0, 0, 0, 0.42);
  color-scheme: dark;
}

html {
  background: var(--body-bg);
}

body {
  font-family: var(--font-ui) !important;
  min-height: 100vh;
  padding: var(--space-edge);
  background: transparent !important;
  color: var(--text-primary);
  line-height: 1.55;
}

body::before,
body.dark-mode::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(circle at 12% 12%, rgba(66, 207, 115, 0.16), transparent 24%),
    radial-gradient(circle at 88% 10%, rgba(152, 240, 171, 0.12), transparent 20%),
    radial-gradient(circle at 85% 82%, rgba(73, 154, 101, 0.16), transparent 26%),
    linear-gradient(180deg, var(--body-bg-strong) 0%, var(--body-bg) 52%, #07110c 100%);
  background-repeat: no-repeat;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.045), transparent 32%),
    linear-gradient(315deg, rgba(255, 255, 255, 0.03), transparent 28%);
  opacity: 0.95;
}

body.dark-mode img[src*="fonts.gstatic.com"] {
  filter: none;
}

body,
button,
input,
select,
textarea,
.metric-label,
.metric-value,
.account-menu-title,
.account-passkey-status,
.why-link {
  font-family: var(--font-ui) !important;
}

h1,
h2,
h3,
h4,
h5,
h6,
.tile h1,
.tile h2,
.tile h3,
.garden-title {
  font-family: var(--font-display) !important;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  overflow-wrap: anywhere;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 2.4vw, 2.8rem);
}

h2 {
  font-size: clamp(1.35rem, 1.8vw, 2rem);
  border-bottom: 1px solid rgba(177, 206, 188, 0.18);
  padding-bottom: 0.4rem;
}

h3 {
  font-size: clamp(1.1rem, 1.35vw, 1.45rem);
}

p,
label,
li,
td,
th,
small,
.calendar-summary,
.calendar-summary-range,
.updated-at,
.progress-summary,
.device-label,
.nutri-label,
.page-status {
  color: var(--text-secondary);
}

a {
  color: inherit;
}

img,
video {
  border: none;
  box-shadow: none;
  margin-top: 0;
}

.tile-container {
  width: min(100%, var(--page-max-width));
  margin: 0 auto;
  padding-bottom: 3rem;
  align-items: start;
  gap: clamp(16px, 1.5vw, 24px);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
}

.tile-container > .tile:first-child {
  grid-column: 1 / -1;
  width: auto;
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: clamp(18px, 1.8vw, 28px);
  box-sizing: border-box;
  border-radius: var(--radius-card);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 24%),
    var(--surface-strong);
  border: 1px solid var(--surface-border);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(24px);
  overflow: hidden;
}

body.dark-mode .tile {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 24%),
    var(--surface-strong);
}

.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.tile:hover {
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.2);
}

body.dark-mode .tile:hover {
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.52);
}

.markdown-style,
.analysis-text,
.json-viewer,
.logStream,
pre {
  background: var(--surface-soft);
  color: var(--text-primary);
  border: 1px solid var(--surface-border);
  border-radius: 16px;
}

.logStream {
  padding: 0.9rem;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="date"],
input[type="datetime-local"],
textarea,
select {
  width: 100%;
  padding: 0.8rem 0.95rem;
  border-radius: 14px;
  border: 1px solid rgba(125, 168, 143, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  box-shadow: none;
}

body.dark-mode input[type="text"],
body.dark-mode input[type="number"],
body.dark-mode input[type="password"],
body.dark-mode input[type="date"],
body.dark-mode input[type="datetime-local"],
body.dark-mode textarea,
body.dark-mode select {
  background: rgba(7, 18, 13, 0.85);
  border-color: rgba(155, 205, 175, 0.14);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
textarea:focus,
select:focus {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(126, 232, 154, 0.5);
  box-shadow: 0 0 0 4px rgba(66, 207, 115, 0.16);
}

body.dark-mode input[type="text"]:focus,
body.dark-mode input[type="number"]:focus,
body.dark-mode input[type="password"]:focus,
body.dark-mode input[type="date"]:focus,
body.dark-mode input[type="datetime-local"]:focus,
body.dark-mode textarea:focus,
body.dark-mode select:focus {
  background: rgba(12, 28, 20, 0.96);
}

button,
input[type="submit"],
input[type="button"],
.page-link,
.downloadLogs,
.save-btn,
.test-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.8rem;
  padding: 0.72rem 1.1rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(135deg, var(--brand-600), var(--brand-700));
  color: #f7fff9;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.01em;
  box-shadow: 0 14px 30px rgba(22, 111, 63, 0.2);
}

button:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
.page-link:hover,
.downloadLogs:hover,
.save-btn:hover,
.test-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(22, 111, 63, 0.26);
}

button:active,
input[type="submit"]:active,
input[type="button"]:active {
  transform: translateY(0);
}

.page-link,
.page-link:hover {
  color: #f7fff9;
}

.page-link.is-disabled {
  background: rgba(127, 151, 137, 0.2);
  color: var(--text-muted);
  border-color: rgba(127, 151, 137, 0.14);
  box-shadow: none;
}

body.dark-mode .help-icon,
body.dark-mode .why-link {
  color: var(--brand-400);
}

body.dark-mode .help-icon {
  background: rgba(197, 176, 137, 0.16);
}

body.dark-mode .help-icon::before {
  border-top-color: rgba(31, 34, 31, 0.98);
}

body.dark-mode .help-icon::after {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(31, 34, 31, 0.98);
  color: var(--text-primary);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.38);
}

#menu-bar {
  --menu-icon-size: 46px;
  top: var(--space-edge);
  gap: 1rem;
  padding: 0.78rem 0.95rem;
  margin-bottom: 0.4rem;
  box-sizing: border-box;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 100%),
    var(--surface-strong);
  border: 1px solid var(--surface-border);
  border-radius: 28px;
  box-shadow: var(--shadow-menu);
  backdrop-filter: blur(26px);
}

#menu-bar.menu-compact {
  --menu-icon-size: 40px;
}

#menu-bar.menu-tiny {
  --menu-icon-size: 34px;
}

#menu-bar .logo {
  width: 74px;
  height: 74px;
  padding: 0.7rem;
  border-radius: 24px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

#menu-bar .menu-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "links topbar";
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  box-sizing: border-box;
}

.menu-topbar {
  grid-area: topbar;
  justify-content: flex-end;
  align-self: start;
}

#menu-bar .menu-links {
  grid-area: links;
  justify-content: flex-start;
  gap: 0.7rem;
  overflow-x: auto;
}

#menu-bar .menu-links .button-image {
  width: 76px;
  height: 64px;
  position: relative;
  isolation: isolate;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

#menu-bar .menu-links .button-image :is(img, svg, lottie-player, .lottie) {
  width: var(--menu-icon-size) !important;
  height: var(--menu-icon-size) !important;
  min-width: var(--menu-icon-size);
  min-height: var(--menu-icon-size);
  max-width: var(--menu-icon-size);
  max-height: var(--menu-icon-size);
  flex: 0 0 auto;
  display: block;
  border-radius: 16px;
}

.menu-icon {
  overflow: visible;
}

#menu-bar .menu-links .button-image:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.1);
}

#menu-bar .menu-links .button-image::before {
  content: none !important;
  display: none !important;
}

.menu-links a.active,
body.dark-mode .menu-links a.active {
  position: relative;
  z-index: 1;
  border: 1px solid rgba(126, 232, 154, 0.45);
  background: linear-gradient(180deg, rgba(66, 207, 115, 0.28), rgba(32, 155, 86, 0.24));
  box-shadow: 0 14px 32px rgba(32, 155, 86, 0.24);
}

#menu-bar .menu-links .button-image[data-tooltip]::after,
.account-toggle[data-tooltip]::after {
  bottom: calc(100% + 10px);
  padding: 0.35rem 0.6rem;
  border-radius: 12px;
  background: rgba(11, 27, 19, 0.9);
  border: 1px solid rgba(155, 205, 175, 0.14);
  color: #eef8f1;
}

.account-toggle {
  width: 60px;
  height: 60px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  box-sizing: border-box;
}

.account-toggle-logo {
  width: 34px;
  height: 34px;
}

.account-dropdown {
  width: min(360px, calc(100vw - (var(--space-edge) * 2)));
  min-width: 300px;
  max-width: calc(100vw - (var(--space-edge) * 2));
  border-radius: 24px;
  background: var(--surface-strong);
  border: 1px solid var(--surface-border);
  box-sizing: border-box;
  transform-origin: top right;
}

.account-menu-setting,
.account-menu-action {
  border-radius: 16px;
  box-sizing: border-box;
}

.account-menu-copy .account-menu-title,
.account-menu-action .account-menu-title {
  color: var(--text-primary);
}

.account-menu-icon {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 14px;
}

.account-menu-action:hover,
.account-menu-action:focus {
  background: rgba(66, 207, 115, 0.12);
}

.account-dialog-card,
.timelapse-calendar-card,
.settings-group,
.camera-control-group,
.update-card {
  background: var(--surface);
  border-color: var(--surface-border);
  box-shadow: var(--shadow-card);
}

.garden-header {
  justify-content: flex-start;
}

.plant-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.plant-card {
  display: grid;
  gap: 0.85rem;
  align-content: start;
  min-height: 180px;
  padding: 1.15rem;
  border-radius: 20px;
  background: var(--surface-soft);
  border: 1px solid var(--surface-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.garden-lottie {
  margin: 0;
}

.calendar-toolbar {
  align-items: center;
  margin-bottom: 1.15rem;
}

#calendarTile,
#selectorTile,
#timelapseTile,
#plantsTile {
  grid-column: 1 / -1;
}

#calendarTile .calendar-grid,
#selectorTile .calendar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 0.8rem;
}

#calendarTile .calendar-day,
#selectorTile .calendar-day {
  width: auto;
  height: 142px;
  border-radius: 18px;
  border: 1px solid rgba(155, 205, 175, 0.14);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

#calendarTile .calendar-day video,
#calendarTile .calendar-day .no-video,
#calendarTile .calendar-day img,
#selectorTile .calendar-day img {
  width: 100%;
  height: 100%;
  margin: 0;
  border-radius: 16px;
}

#calendarTile .calendar-thumb-video {
  inset: 0;
  border-radius: 16px;
}

#calendarTile .thumb-date,
#selectorTile .thumb-date {
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.22rem 0.45rem;
  border-radius: var(--radius-pill);
  background: rgba(6, 17, 12, 0.8);
}

#calendarTile .thumb-day {
  right: 0.5rem;
  bottom: 0.5rem;
  padding: 0.28rem 0.5rem;
  border-radius: var(--radius-pill);
}

#calendarTile .legend,
#selectorTile .legend,
#growProgress .legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.85rem;
  margin-top: 1.1rem;
}

#calendarTile .legend-item,
#selectorTile .legend-item,
#growProgress .legend-item {
  color: var(--text-secondary);
}

.thumb-button {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  cursor: pointer;
}

.thumb-button:hover {
  transform: none;
  box-shadow: none;
}

body.page-grow-selector .date-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.85rem;
  align-items: end;
  margin-bottom: 1.4rem;
}

body.page-grow-selector .date-form label {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  font-weight: 600;
}

body.page-timelapse #timelapseTile {
  gap: 1.4rem;
}

body.page-timelapse .radio-container.timelapse-picker {
  width: 100%;
  margin: 0;
}

body.page-timelapse #timelapseVideo,
body.page-timelapse #videoProgress,
body.page-timelapse #videoDate {
  width: 100%;
  max-width: none !important;
}

body.page-timelapse #videoDate {
  position: static;
  color: var(--text-primary);
  background: var(--surface-soft);
  border-radius: 16px;
  margin: 0;
}

body.page-dashboard .tile:not(#menu-bar) {
  min-height: 310px;
}

body.page-dashboard .tile .updated-at,
body.page-dashboard .tile p,
body.page-dashboard .tile li {
  color: var(--text-secondary);
}

body.page-dashboard .tile:not(#menu-bar) lottie-player {
  width: min(180px, 100%);
  height: 180px !important;
}

body.page-dashboard .toggle-details {
  margin-top: auto;
}

body.page-dashboard #growProgress .calendar-grid {
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.6rem;
}

body.page-dashboard #growProgress .calendar-day {
  width: auto;
  height: 112px;
  border-radius: 18px;
}

body.page-analysis-overview .analysis-card {
  min-height: 220px;
  justify-content: space-between;
}

body.page-analysis-overview .analysis-card h1 {
  font-size: clamp(1.55rem, 1.8vw, 2.15rem);
  line-height: 1.08;
}

body.page-settings .tile,
body.page-observability .tile {
  min-height: 0;
}

body.page-observability .tile {
  gap: 1rem;
}

body.page-observability .tile > h2:first-child {
  margin-bottom: 0.15rem;
}

body.page-observability .tile h3 {
  margin-top: 0.25rem;
  font-size: clamp(1rem, 1.05vw, 1.2rem);
}

body.page-observability .tile-container {
  display: grid;
}

body.page-observability .observability-masonry {
  grid-column: 1 / -1;
  align-self: start;
  column-count: 4;
  column-gap: clamp(16px, 1.5vw, 24px);
  column-fill: balance;
}

body.page-observability .observability-masonry > .tile {
  display: inline-flex;
  width: 100%;
  margin: 0 0 clamp(16px, 1.5vw, 24px);
  break-inside: avoid;
  page-break-inside: avoid;
}

body.page-observability .device-grid {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.85rem !important;
  margin-bottom: 0;
}

body.page-observability .device-item {
  min-height: 140px;
  padding: 1rem 0.85rem;
  border-radius: 18px;
  border: 1px solid rgba(155, 205, 175, 0.14);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

body:not(.dark-mode).page-observability .device-item,
body:not(.dark-mode).page-observability .plant-overview-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 250, 246, 0.96)),
    var(--surface-strong);
  border-color: rgba(23, 111, 63, 0.18);
  box-shadow:
    0 12px 24px rgba(21, 45, 31, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

body:not(.dark-mode).page-observability .device-item.problem {
  background:
    linear-gradient(180deg, rgba(255, 245, 241, 0.98), rgba(255, 238, 232, 0.96)),
    var(--surface-strong);
  border-color: rgba(213, 80, 53, 0.28);
  box-shadow:
    0 12px 24px rgba(186, 88, 57, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

body.page-observability .device-item img {
  margin-bottom: 0.45rem;
}

body.page-observability .device-label {
  display: grid;
  gap: 0.2rem;
  width: 100%;
  text-align: center;
  color: var(--text-secondary);
}

body.page-observability .metric-value {
  font-size: clamp(1.1rem, 1.15vw, 1.35rem);
  line-height: 1.1;
}

body.page-observability .metric-label {
  color: var(--text-secondary);
}

body.page-observability .device-meta {
  display: grid;
  gap: 0.15rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

body.page-observability #statusMetrics .device-item {
  min-height: 0;
}

body.page-observability #growWarnings {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-secondary);
}

body.page-observability .obs-subpanel {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  border-radius: 20px;
  background: var(--surface-soft);
  border: 1px solid var(--surface-border);
}

body:not(.dark-mode).page-observability .obs-subpanel,
body:not(.dark-mode).page-observability .obs-details {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(244, 249, 245, 0.94)),
    var(--surface-soft);
  border-color: rgba(23, 111, 63, 0.18);
  box-shadow:
    0 10px 22px rgba(21, 45, 31, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

body.page-observability .obs-key-value {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 0;
  color: var(--text-secondary);
}

body.page-observability .obs-key-value strong {
  color: var(--text-primary);
  font-size: 1.15rem;
}

body.page-observability .obs-supporting-copy {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

body.page-observability .obs-form-stack,
body.page-observability .obs-field {
  display: grid;
  gap: 0.45rem;
}

body.page-observability .obs-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

body.page-observability .obs-details {
  border: 1px solid var(--surface-border);
  border-radius: 18px;
  background: var(--surface-soft);
  padding: 0.25rem 0.9rem 0.9rem;
}

body.page-observability .obs-details + .obs-details {
  margin-top: 0.8rem;
}

body.page-observability .obs-details summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--text-primary);
  padding: 0.55rem 0;
}

body.page-observability .obs-details[open] summary {
  margin-bottom: 0.5rem;
}

body.page-observability .job-aggregates__column {
  overflow-x: auto;
}

body.page-observability .job-aggregates__table {
  min-width: 720px;
  font-size: 0.88rem;
}

body.page-observability .plants-overview-grid {
  display: grid;
  gap: 0.9rem;
}

body.page-observability .plant-overview-card {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(155, 205, 175, 0.14);
}

body.page-observability .plant-overview-card h3 {
  margin: 0;
}

body.page-observability .obs-stat-list {
  display: grid;
  gap: 0.75rem;
  margin: 0;
}

body.page-observability .obs-stat-list > div {
  display: grid;
  gap: 0.18rem;
}

body.page-observability .obs-stat-list dt {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

body.page-observability .obs-stat-list dd {
  margin: 0;
  color: var(--text-primary);
  font-weight: 600;
}

body.page-observability .progress-stat-list {
  margin-top: 0.85rem;
}

body.page-observability .camera-feeds {
  margin-top: 0;
}

body.page-observability .camera-feeds img {
  border-color: rgba(155, 205, 175, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}

body:not(.dark-mode).page-observability .camera-feeds img {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(23, 111, 63, 0.18);
  box-shadow:
    0 10px 20px rgba(21, 45, 31, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

.settings-group,
.camera-control-group {
  padding: 1rem;
  border-radius: 20px;
}

.status-message.ok {
  color: var(--success-600);
}

.status-message.error {
  color: var(--danger-600);
}

.tooltip {
  border-radius: 14px;
  border-color: rgba(155, 205, 175, 0.18) !important;
}

#loading-overlay {
  background: rgba(6, 17, 12, 0.56);
}

#loading-overlay img {
  width: 110px;
}

@media (max-width: 1100px) {
  body {
    padding: clamp(12px, 2.4vw, 22px);
  }

  #menu-bar .menu-content {
    grid-template-columns: 1fr;
    grid-template-areas:
      "topbar"
      "links";
  }

  .menu-topbar {
    justify-content: flex-end;
  }

  #menu-bar .menu-links {
    justify-content: flex-start;
    flex-wrap: nowrap;
  }

  body.page-dashboard .tile:not(#menu-bar) {
    min-height: 0;
  }

  body.page-observability .observability-masonry {
    column-count: 2;
  }
}

@media (max-width: 720px) {
  body {
    padding: 12px;
  }

  #menu-bar {
    --menu-icon-size: 38px;
    top: 12px;
    border-radius: 22px;
  }

  #menu-bar .logo {
    width: 60px;
    height: 60px;
  }

  #menu-bar .menu-links .button-image,
  #menu-bar.menu-compact .menu-links .button-image,
  #menu-bar.menu-tiny .menu-links .button-image {
    width: 62px;
    height: 56px;
    border-radius: 18px;
  }

  #menu-bar .menu-links .button-image :is(img, svg, lottie-player, .lottie),
  #menu-bar.menu-compact .menu-links .button-image :is(img, svg, lottie-player, .lottie),
  #menu-bar.menu-tiny .menu-links .button-image :is(img, svg, lottie-player, .lottie) {
    width: 38px;
    height: 38px;
  }

  #calendarTile .calendar-grid,
  #selectorTile .calendar-grid,
  body.page-dashboard #growProgress .calendar-grid {
    grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
  }

  #calendarTile .calendar-day,
  #selectorTile .calendar-day {
    height: 108px;
  }

  .account-dropdown {
    min-width: 0;
    width: min(320px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    left: auto;
    right: 0;
    transform: none;
  }

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

  body.page-observability .observability-masonry {
    column-count: 1;
  }
}
