* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --green: #1f9d55;
  --green-dark: #147a41;
  --green-soft: #e6f6ec;
  --blue: #2f74d0;
  --blue-2: #4a90e2;
  --bg: #f4f8f5;
  --card: #ffffff;
  --ink: #1b2620;
  --muted: #5f6f66;
  --line: #e6ebe7;
  --danger: #c0392b;
  --radius: 18px;
  --shadow-sm: 0 1px 2px rgba(20,40,30,.05), 0 1px 3px rgba(20,40,30,.05);
  --shadow: 0 4px 14px rgba(20,45,32,.07), 0 1px 3px rgba(20,45,32,.05);
  --shadow-lg: 0 18px 44px rgba(18,40,28,.16);
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink); -webkit-font-smoothing: antialiased;
  background: radial-gradient(1200px 600px at 80% -10%, #e9f4ec 0%, var(--bg) 55%) fixed;
}

.app { display: flex; min-height: 100vh; }

/* sidebar */
.sidebar {
  width: 244px; flex-shrink: 0; color: var(--ink);
  background: #fff;
  display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh;
  border-right: 1px solid var(--line);
}
.brand { display: flex; gap: 11px; align-items: center; padding: 4px 8px 20px; }
/* The logo carries its own gradient (same file as the website), so it needs no
   tinted tile behind it. A drop shadow keeps it from floating on dark panels. */
.brand-mark {
  width: 40px; height: 40px; display: grid; place-items: center; flex-shrink: 0;
}
.brand-mark img { width: 38px; height: 38px; display: block; }
.brand-name { font-weight: 700; font-size: 17px; color: var(--ink); letter-spacing: -.2px; }
.brand-sub { font-size: 10.5px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; margin-top: 1px; }
nav { display: flex; flex-direction: column; gap: 3px; }
.nav-btn {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px; border: 0; background: none;
  color: var(--muted); font-size: 14px; border-radius: 12px; cursor: pointer; text-align: left; font-weight: 500;
  font-family: inherit; transition: background .15s, color .15s;
}
.nav-ic { display: inline-flex; }
.nav-ic svg { width: 19px; height: 19px; }
@media (hover: hover) {
  .nav-btn:hover { background: var(--green-soft); color: var(--green-dark); }
}
.nav-btn.active { background: linear-gradient(145deg, var(--green-dark) 0%, #0f6e38 100%); color: #fff; box-shadow: 0 6px 16px rgba(20,122,65,.28); }
.sidebar-foot { margin-top: auto; padding: 12px 10px 2px; border-top: 1px solid var(--line); }
.lang-switch { position: relative; margin-top: 16px; padding: 0 4px; }
.lang-current {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font-size: 12.5px; font-weight: 700; border-radius: 10px; cursor: pointer; font-family: inherit; transition: all .15s;
}
.lang-current:hover { background: var(--green-soft); border-color: var(--green); }
.lang-current .flag { font-size: 15px; line-height: 1; }
.lang-current .chev { color: var(--muted); font-size: 10px; }
.lang-menu {
  position: absolute; z-index: 50; left: 4px; top: calc(100% + 6px); min-width: 168px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 5px;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 2px;
}
.lang-opt {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 0; background: none;
  color: var(--ink); font-size: 13px; font-weight: 600; border-radius: 8px; cursor: pointer; font-family: inherit; text-align: left; white-space: nowrap;
}
.lang-opt .flag { font-size: 16px; line-height: 1; }
.lang-opt:hover { background: var(--green-soft); color: var(--green-dark); }

/* generic inline icon */
.ic { display: inline-flex; vertical-align: middle; }
.ic svg { width: 16px; height: 16px; display: block; }
.weather-refresh { margin-left: auto; align-self: flex-start; }
.garden-time { font-size: 14px; font-weight: 600; color: var(--ink); }
.garden-loc { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* main */
.main { flex: 1; padding: 30px 36px; max-width: 1080px; }
.view-head { margin-bottom: 20px; }
.view-head.row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
h1 { font-size: 25px; margin-bottom: 4px; letter-spacing: -.4px; }
.section-title { font-size: 12.5px; margin: 26px 0 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; font-weight: 700; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 12px; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; }
.gap { gap: 12px; }
.grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 14px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }

/* KPI row */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 17px; box-shadow: var(--shadow); overflow: hidden; transition: transform .15s, box-shadow .15s; }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--line); }
.kpi-label { font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.kpi-big { font-size: 27px; font-weight: 700; margin: 5px 0 2px; line-height: 1.05; letter-spacing: -.5px; }
.kpi-sub { font-size: 12.5px; color: var(--muted); }
.kpi-green::before { background: linear-gradient(180deg, var(--green), var(--green-dark)); }
.kpi-blue::before { background: linear-gradient(180deg, var(--blue-2), var(--blue)); }
.kpi-amber::before { background: linear-gradient(180deg, #e5b45a, #d9a03c); }
.kpi-plain::before { background: #cdd7d0; }
.kpi-click { cursor: pointer; }
.kpi-click:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

/* weather */
.weather-card { display: flex; flex-direction: column; gap: 16px; }
.weather-offline { color: var(--muted); font-size: 14px; padding: 20px; text-align: center; }
.weather-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.weather-now { display: flex; gap: 14px; align-items: center; }
.weather-icon { line-height: 0; }
.weather-icon svg { display: block; }
.weather-temp { font-size: 44px; font-weight: 700; line-height: 1; letter-spacing: -1px; }
.weather-cond { font-size: 14px; color: var(--muted); margin-top: 4px; font-weight: 500; }
.weather-stats { display: flex; gap: 20px; font-size: 13.5px; color: var(--ink); align-items: center; flex-wrap: wrap; }
.weather-stats > div { display: inline-flex; align-items: center; gap: 6px; }
.weather-stats .ic { color: var(--muted); }
.weather-stats .ic svg { width: 17px; height: 17px; }
.rain-banner { font-size: 13px; padding: 9px 14px; border-radius: 10px; font-weight: 600; }
.rain-banner.on { background: #e3edf7; color: #2c6ca8; }
.rain-banner.off { background: var(--green-soft); color: var(--green-dark); }
.rain-banner.ask { background: #fbf1dd; color: #9a6b12; }
.weather-live { color: var(--green-dark); font-weight: 600; font-size: 12px; }

/* rain decision prompts */
.rain-prompt { display: flex; align-items: center; gap: 16px; background: #fbf1dd; border: 1px solid #f0dcae; border-radius: var(--radius); padding: 14px 18px; margin-bottom: 12px; }
.rp-text { flex: 1; font-size: 14px; color: #7a5410; }
.rp-sub { font-size: 12px; color: #9a7b40; margin-top: 3px; }
.rp-actions { display: flex; gap: 8px; flex-shrink: 0; }
.rain-bands { display: flex; flex-direction: column; gap: 8px; }
.ev.ask { color: #b07a1e; }
.ev.err { color: var(--danger); }

.hourly { position: relative; border-top: 1px solid var(--line); padding-top: 14px; }
.temp-line { position: absolute; top: 8px; left: 2%; width: 96%; height: 40px; opacity: .35; pointer-events: none; }
.hour-strip { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; text-align: center; }
.hour-col { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 2px 0; }
.hour-temp { font-size: 13px; font-weight: 700; }
.hour-ico { font-size: 20px; line-height: 0; }
.hour-ico svg { display: block; }
.daily-ico svg { display: block; margin: 0 auto; }
.hour-rain { font-size: 11px; color: #9aa8a0; font-weight: 600; }
.hour-rain.wet { color: var(--blue); }
.hour-t { font-size: 11px; color: var(--muted); }

.daily-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; }
.daily-col { text-align: center; background: #f7faf7; border-radius: 10px; padding: 10px 6px; }
.daily-day { font-size: 12px; font-weight: 700; color: var(--muted); }
.daily-ico { font-size: 24px; margin: 4px 0; }
.daily-rain { font-size: 11.5px; color: var(--blue); margin-bottom: 4px; }
.daily-temp { font-size: 13px; }
.daily-temp span { color: var(--muted); }

/* zones */
.zone-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.zone-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); transition: box-shadow .2s, border-color .2s; }
.zone-card.watering { border-color: rgba(47,116,208,.5); box-shadow: 0 0 0 3px rgba(47,116,208,.14), var(--shadow); }
.zone-top { display: flex; align-items: center; gap: 11px; margin-bottom: 15px; }
.zone-icon { font-size: 24px; position: relative; width: 30px; height: 30px; display: grid; place-items: center; line-height: 1; flex-shrink: 0; }
.zone-name { font-weight: 650; font-size: 16px; flex: 1; display: flex; align-items: center; gap: 7px; }
.badge { font-size: 10.5px; font-weight: 700; padding: 4px 10px; border-radius: 20px; text-transform: uppercase; letter-spacing: .5px; }
.badge.idle { background: #eef1ee; color: var(--muted); }
.badge.on { background: linear-gradient(135deg, #2361b5, var(--blue)); color: #fff; display: inline-flex; align-items: center; gap: 5px; }
.badge.on::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: pulse 1.3s infinite; }
.badge.wait { background: #fbf1dd; color: #9a6b12; }
.zone-card.waiting { border-color: #f0dcae; box-shadow: 0 0 0 3px rgba(217,160,60,.14), var(--shadow); }
.countdown.wait { color: #9a6b12; font-weight: 600; }
.skip-note { font-size: 12.5px; color: #2c6ca8; font-weight: 600; background: #eef4fb; border-radius: 9px; padding: 7px 11px; margin-bottom: 13px; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* watering droplet over the zone icon */
.zone-icon.is-watering { animation: iconbob 2.2s ease-in-out infinite; }
.zone-icon .drip {
  position: absolute; top: -7px; left: 50%; transform: translateX(-50%);
  font-size: 13px; line-height: 1; pointer-events: none; animation: drip 1.6s ease-in infinite;
}
@keyframes drip {
  0% { transform: translateX(-50%) translateY(-2px) scale(.7); opacity: 0; }
  25% { opacity: 1; }
  70% { transform: translateX(-50%) translateY(16px) scale(1); opacity: .9; }
  100% { transform: translateX(-50%) translateY(24px) scale(.6); opacity: 0; }
}
@keyframes iconbob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.5px); } }
.zone-icon .ripple {
  position: absolute; bottom: -3px; left: 50%; width: 22px; height: 6px; transform: translateX(-50%);
  border-radius: 50%; background: radial-gradient(closest-side, rgba(47,116,208,.35), transparent);
  animation: ripple 1.6s ease-out infinite;
}
@keyframes ripple { 0%, 60% { opacity: 0; transform: translateX(-50%) scale(.4); } 80% { opacity: .8; } 100% { opacity: 0; transform: translateX(-50%) scale(1.3); } }

.moisture { margin-bottom: 15px; }
.moisture-label { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.moisture-bar { height: 9px; background: #edf0ed; border-radius: 6px; overflow: hidden; }
.moisture-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, #e0a53f, var(--green)); transition: width .8s; }
.zone-actions { display: flex; gap: 8px; }
.countdown { font-size: 13px; color: var(--blue); font-weight: 700; margin-bottom: 13px; display: flex; align-items: center; gap: 6px; }

/* zone manage list */
.zone-row { display: flex; align-items: center; gap: 14px; }
.zone-row .zone-icon { font-size: 26px; }
.zone-row-info { flex: 1; }
.zone-row-name { font-weight: 600; }
.zone-row-sub { font-size: 13px; color: var(--muted); }

/* schedules */
.sch-zone-name { font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.sch-row { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.sch-time { font-weight: 700; font-size: 16px; width: 64px; }
.sch-days { color: var(--muted); flex: 1; }
.tag { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 6px; background: var(--green-soft); color: var(--green-dark); }
.tag.off { background: #eef1ee; color: var(--muted); }

/* table */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
.ev { font-weight: 600; }
.ev.start { color: var(--blue); }
.ev.stop { color: var(--muted); }
.ev.skip { color: #b07a1e; }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 6px; position: relative; min-width: 0; }
/* Listing input types one by one means a new type silently loses its styling
   and sits a few pixels off. Style every input in a field and opt the checkbox
   back out, so adding a type is not a design bug waiting to happen. */
.field input:not([type=checkbox]):not([type=radio]), .field select {
  padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px; font-size: 14px; background: #fff; font-family: inherit; color: var(--ink);
}
.field input:focus, .field select:focus { outline: 2px solid var(--green); border-color: transparent; }
.time-24 { text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.check { display: flex; gap: 9px; align-items: center; font-size: 14px; margin: 10px 0; }
.check input { width: 17px; height: 17px; accent-color: var(--green); }
.toggle-row { align-items: flex-start; }
.toggle-row input { margin-top: 2px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 17px; border-radius: 11px; border: 1px solid var(--line); background: #fff;
  font-size: 13.5px; font-weight: 650; cursor: pointer; color: var(--ink); font-family: inherit;
  transition: transform .12s, box-shadow .12s, background .12s; white-space: nowrap;
}
.btn .ic svg { width: 15px; height: 15px; }
.btn:hover { background: #f4f7f4; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; box-shadow: none; filter: none; transform: none; }
.btn.primary { background: linear-gradient(145deg, var(--green-dark), #0f6e38); border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(20,122,65,.26); }
.btn.primary:hover { box-shadow: 0 8px 20px rgba(31,157,85,.36); filter: brightness(1.04); }
.btn.blue { background: linear-gradient(145deg, #2361b5, var(--blue)); border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(47,116,208,.28); }
.btn.blue:hover { box-shadow: 0 8px 20px rgba(47,116,208,.36); filter: brightness(1.04); }
.btn.danger-text { color: var(--danger); }
.btn.sm { padding: 8px 13px; font-size: 12.5px; border-radius: 9px; }
.saved-note { color: var(--green-dark); font-size: 13px; font-weight: 600; margin-left: 8px; }

.loc-results { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 9px; z-index: 30; box-shadow: 0 8px 24px rgba(0,0,0,.1); overflow: hidden; }
.loc-results:empty { display: none; }
.loc-item { padding: 10px 12px; cursor: pointer; font-weight: 500; }
.loc-item:hover { background: var(--green-soft); }

/* modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(16,26,20,.5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 60; padding: 16px; }
.modal { background: #fff; border-radius: 22px; padding: 26px 26px 24px; width: min(468px, 94vw); box-shadow: var(--shadow-lg); animation: modalpop .18s ease-out; }
@keyframes modalpop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal h3 { margin-bottom: 20px; font-size: 20px; letter-spacing: -.3px; }
.modal .field { margin-bottom: 16px; }
.modal .field > span { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.modal-actions .btn { padding: 11px 20px; }

/* day selector: equal-width rounded pills */
.day-row { display: flex; gap: 6px; }
.icon-row { display: flex; gap: 8px; flex-wrap: wrap; }
.day-chip {
  flex: 1; padding: 11px 0; text-align: center; border-radius: 12px; border: 1.5px solid var(--line);
  background: #fff; cursor: pointer; font-size: 13px; font-weight: 700; font-family: inherit; color: var(--muted);
  transition: all .13s;
}
.day-chip:hover { border-color: var(--green); color: var(--green-dark); background: var(--green-soft); }
.day-chip.on { background: linear-gradient(145deg, var(--green-dark), #0f6e38); border-color: transparent; color: #fff; box-shadow: 0 5px 13px rgba(20,122,65,.28); }
.icon-chip {
  width: 46px; height: 46px; display: grid; place-items: center; border-radius: 13px; border: 1.5px solid var(--line);
  background: #fff; cursor: pointer; font-size: 20px; font-family: inherit; transition: all .13s;
}
.icon-chip:hover { border-color: var(--green); background: var(--green-soft); }
.icon-chip.on { border-color: var(--green); background: var(--green-soft); box-shadow: inset 0 0 0 1.5px var(--green); }

/* per-day time list in the schedule modal */
.daytimes { display: flex; flex-direction: column; gap: 8px; }
.daytime-row { display: flex; align-items: center; gap: 12px; }
.daytime-day { width: 46px; flex-shrink: 0; font-weight: 700; font-size: 13.5px; color: var(--ink); }
.daytime-row .stepper { flex: 1; max-width: 220px; }
.dur-stepper { max-width: 200px; }

/* rain option as a soft card inside the modal */
.modal .check { margin: 2px 0 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 13px; background: #f7faf7; font-size: 13.5px; font-weight: 500; line-height: 1.4; }
.modal .check input { flex-shrink: 0; }

/* number stepper (5-minute buttons, native arrows removed) */
.stepper { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.stepper:focus-within { outline: 2px solid var(--green); border-color: transparent; }
.stepper input { border: 0 !important; border-radius: 0 !important; text-align: center; flex: 1; min-width: 0; }
.stepper input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.stepper input:focus { outline: none; }
.stepper input[type=number]::-webkit-outer-spin-button,
.stepper input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.step-btn {
  border: 0; background: var(--green-soft); color: var(--green-dark);
  width: 46px; flex-shrink: 0; font-size: 22px; font-weight: 700; line-height: 1;
  cursor: pointer; font-family: inherit; user-select: none;
}
.step-btn:first-child { border-right: 1px solid var(--line); }
.step-btn:last-child { border-left: 1px solid var(--line); }
.step-btn:hover { background: var(--green-dark); color: #fff; }
.step-btn:active { background: var(--green-dark); color: #fff; }

/* hardware tags + status */
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-right: 4px; box-shadow: 0 0 0 0 rgba(47,158,95,.5); animation: livepulse 1.8s infinite; vertical-align: middle; }
@keyframes livepulse { 70% { box-shadow: 0 0 0 6px rgba(47,158,95,0); } 100% { box-shadow: 0 0 0 0 rgba(47,158,95,0); } }
.hw-tag { font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 5px; text-transform: uppercase; letter-spacing: .3px; vertical-align: middle; }
.hw-tag.live { background: var(--green-soft); color: var(--green-dark); }
.hw-tag.sim { background: #eef1ee; color: #97a49b; }
.hw-tag.err { background: #f8e3df; color: var(--danger); }
.hw-status { font-size: 14px; font-weight: 600; padding: 10px 14px; border-radius: 10px; }
.hw-status.ok { background: var(--green-soft); color: var(--green-dark); }
.hw-status.off { background: #f0f3f0; color: var(--muted); }

/* segmented control + location boxes */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg-btn { border: 0; background: #fff; padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--muted); font-family: inherit; }
.seg-btn.on { background: var(--green); color: #fff; }
.loc-mode-box { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; align-items: flex-start; }

/* hardware fields in zone modal */
.hw-fields { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; }
.hw-title { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 8px; }

/* history date-range picker */
.range-picker { position: relative; flex-shrink: 0; }
.range-btn .chev { color: var(--muted); font-size: 11px; margin-left: 2px; }
.range-btn .ic svg { width: 15px; height: 15px; }
.range-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 45;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow-lg); padding: 14px; display: flex; gap: 16px; width: min(580px, 92vw);
}
.range-presets { display: flex; flex-direction: column; gap: 6px; width: 152px; flex-shrink: 0; }
.preset-btn {
  text-align: left; padding: 9px 12px; border: 1px solid var(--line); background: #fff;
  border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; color: var(--ink); transition: all .12s;
}
.preset-btn:hover { background: var(--green-soft); border-color: var(--green); }
.preset-btn.on { background: linear-gradient(145deg, var(--green-dark), #0f6e38); border-color: transparent; color: #fff; }
.range-cal { flex: 1; min-width: 0; }
.cal-title-row { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 8px; }
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-weight: 700; font-size: 15px; }
.cal-arrow { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 17px; color: var(--ink); line-height: 1; }
.cal-arrow:hover { background: var(--green-soft); border-color: var(--green); }
.cal-dow, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-dow { font-size: 10.5px; color: var(--muted); text-align: center; margin-bottom: 4px; }
.cal-dow div { padding: 4px 0; font-weight: 700; }
.cal-cell { aspect-ratio: 1; display: grid; place-items: center; font-size: 13px; border-radius: 12px; cursor: pointer; }
.cal-cell:hover:not(.empty):not(.future):not(.edge):not(.band) { background: var(--green-soft); }
.cal-cell.outside { color: #b7c1ba; }
.cal-cell.future { color: #cfd6d0; cursor: not-allowed; }
.cal-cell.future.outside { color: #dde2dd; }
.cal-cell.today { box-shadow: inset 0 0 0 1.5px var(--green); font-weight: 800; }
/* range band: square in the middle, rounded at the range ends and week-row wraps */
.cal-cell.band { background: var(--green-soft); color: var(--ink); border-radius: 0; }
.cal-cell.band.rl { border-top-left-radius: 12px; border-bottom-left-radius: 12px; }
.cal-cell.band.rr { border-top-right-radius: 12px; border-bottom-right-radius: 12px; }
.cal-cell.edge { background: linear-gradient(145deg, var(--green-dark), #0f6e38); color: #fff; box-shadow: 0 4px 11px rgba(20,122,65,.3); }
.cal-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
@media (max-width: 560px) {
  .range-pop { flex-direction: column; width: min(340px, 92vw); }
  .range-presets { flex-direction: row; flex-wrap: wrap; width: 100%; }
  .preset-btn { flex: 1 1 30%; text-align: center; padding: 8px 6px; }
}

/* ---------- phone layout ----------
   The sidebar becomes a slim header and the navigation moves to a bottom tab
   bar, which is where a thumb actually reaches. mobile.js moves the sections
   that do not fit into a "More" sheet. */
@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: sticky; top: 0; z-index: 55;
    flex-direction: row; align-items: center; justify-content: space-between;
    padding: 10px 16px; gap: 10px;
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .brand { padding: 0; }
  .brand-sub { display: none; }
  .brand-mark img { width: 34px; height: 34px; }
  .brand-name { font-size: 17px; }
  .lang-switch { position: static; margin: 0; width: auto; padding: 0; }
  .lang-menu { left: auto; right: 0; }

  nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    flex-direction: row; gap: 0; padding: 6px 4px;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    background: rgba(255,255,255,.94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
  }
  .nav-btn {
    flex: 1 1 0; min-width: 0; flex-direction: column; gap: 3px;
    padding: 7px 2px 5px; font-size: 10.5px; font-weight: 650; letter-spacing: -.1px;
    border-radius: 12px; text-align: center; background: none; box-shadow: none;
  }
  .nav-btn > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
  .nav-ic svg { width: 21px; height: 21px; }
  /* The bar is small; a filled pill would dominate it. Colour alone reads as
     "you are here" without shouting. */
  .nav-btn.active { background: var(--green-soft); color: var(--green-dark); box-shadow: none; }
  .nav-more .nav-ic { font-size: 17px; line-height: 21px; letter-spacing: 1px; }

  /* room for the bar, so the last card is never hidden underneath it */
  body.has-tabbar .main { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  .sidebar-foot { margin: 0; padding: 14px 2px 2px; border-top: 1px solid var(--line); }

  .main { padding: 18px 15px; max-width: 100%; }
  h1 { font-size: 21px; }
  .view-head { margin-bottom: 15px; }
  .section-title { font-size: 12px; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi-big { font-size: 22px; }
  .card { padding: 16px; border-radius: 16px; }
  .weather-head { gap: 12px; }
  .weather-stats { gap: 14px; }
  .hour-col:nth-child(n+8) { display: none; }

  /* A modal that fills a phone screen from the top is a page, not a dialog.
     Docking it to the bottom keeps the buttons under the thumb. */
  .modal-backdrop { place-items: end center; padding: 0; }
  .modal {
    width: 100%; max-width: 100%; border-radius: 22px 22px 0 0;
    padding: 22px 18px calc(20px + env(safe-area-inset-bottom));
    max-height: 88vh; overflow-y: auto; animation: sheetup .2s ease-out;
  }
  .modal-actions { position: sticky; bottom: 0; background: #fff; padding-top: 12px; margin-top: 18px; }
  .modal-actions .btn { flex: 1; justify-content: center; }
}
@media (max-width: 440px) {
  .weather-refresh { margin-left: 0; }
  .hour-col:nth-child(n+6) { display: none; }
  .kpi-row { grid-template-columns: 1fr 1fr; }
}

/* A table wider than the phone scrolls inside its card. Letting the page
   scroll instead moved the fixed tab bar off to the side with it. */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll .table { min-width: 560px; }
@media (max-width: 860px) {
  /* Belt and braces: nothing may widen the document itself. */
  html, body { overflow-x: hidden; }
  .table-scroll { margin: 0 -16px; padding: 0 16px; }
}

/* ---------- the "More" sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(16,26,20,.45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); z-index: 45; display: flex; align-items: flex-end; }
.sheet-backdrop.hidden { display: none; }
.sheet {
  width: 100%; background: #fff; border-radius: 22px 22px 0 0;
  padding: 8px 14px calc(76px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg); animation: sheetup .2s ease-out; max-height: 80vh; overflow-y: auto;
}
.sheet-grip { width: 38px; height: 4px; border-radius: 2px; background: var(--line); margin: 6px auto 12px; }
.sheet-body { display: flex; flex-direction: column; gap: 4px; }
/* Inside the sheet there is room for a normal, readable row again. */
.sheet-body .nav-btn { flex-direction: row; gap: 11px; font-size: 15px; padding: 13px 14px; text-align: left; border-radius: 13px; }
.sheet-body .nav-btn .nav-ic svg { width: 19px; height: 19px; }
.sheet-body .nav-btn.active { background: var(--green-soft); color: var(--green-dark); }
.sheet-body .sidebar-foot { display: block; }
/* No rule above the first thing in the sheet: it separated nothing. */
.sheet-body > .sidebar-foot:first-child { border-top: 0; padding-top: 2px; }
.sheet-body .sidebar-foot .btn { width: 100%; margin-top: 8px; justify-content: center; }
@keyframes sheetup { from { transform: translateY(14px); opacity: .6 } to { transform: none; opacity: 1 } }

/* ---------- auth pages ---------- */
.auth-body { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.auth-wrap { width: min(420px, 100%); position: relative; }
.auth-brand { display: flex; gap: 12px; align-items: center; justify-content: center; margin-bottom: 22px; }
.auth-brand .brand-name { color: var(--ink); font-size: 20px; }
.auth-brand .brand-sub { color: var(--muted); }
.auth-card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 26px; box-shadow: var(--shadow-lg); }
.auth-title { font-size: 19px; letter-spacing: -.3px; margin-bottom: 16px; }
/* The secondary route off this page: visible, but clearly not the main act. */
.auth-alt-sep { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.auth-alt-sep a { display: inline-block; margin-top: 3px; color: var(--green-dark); font-weight: 650; }
.auth-tabs { display: flex; gap: 6px; background: #f1f4f1; padding: 5px; border-radius: 13px; margin-bottom: 20px; }
.auth-tab { flex: 1; padding: 9px 0; border: 0; background: none; border-radius: 9px; font-size: 13.5px; font-weight: 650; color: var(--muted); cursor: pointer; font-family: inherit; }
.auth-tab.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.auth-form { display: flex; flex-direction: column; gap: 4px; }
.auth-submit { width: 100%; margin-top: 10px; padding: 12px; }
.auth-error { color: var(--danger); font-size: 13px; font-weight: 600; min-height: 18px; margin-top: 8px; text-align: center; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 12.5px; color: var(--muted); }
.auth-foot a { color: var(--muted); }
.auth-lang { position: absolute; top: -6px; right: 0; margin: 0; padding: 0; }
.auth-lang .lang-current { background: #fff; border-color: var(--line); color: var(--ink); }
.auth-lang .lang-menu { background: #fff; border-color: var(--line); }
.auth-lang .lang-opt { color: var(--ink); }
.auth-lang .lang-opt:hover { background: var(--green-soft); }
.auth-body .check { font-size: 13px; align-items: flex-start; }
.auth-body .check a { color: var(--green-dark); }

/* ---------- admin ---------- */
.row-dim { opacity: .5; }
.lic-new { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.lic-chip { display: flex; align-items: center; gap: 8px; background: var(--green-soft); border-radius: 11px; padding: 8px 10px; }
.lic-chip code { font-size: 14px; font-weight: 700; color: var(--green-dark); letter-spacing: .5px; }
.table code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* the moments a customer wants to be asked about rain.
   The remove button sits beside the field, not on top of it: inside, it landed
   on the browser's own clock icon. */
.ask-time { display: inline-flex; align-items: center; gap: 2px; }
.ask-time-x {
  border: 0; background: none; color: var(--muted); font-size: 19px; line-height: 1;
  cursor: pointer; padding: 6px 8px; font-family: inherit; border-radius: 9px;
}
@media (hover: hover) { .ask-time-x:hover { color: var(--danger); background: #fdf0ee; } }

/* website enquiries */
.inq-card.inq-new { border-color: #cfe6d8; box-shadow: 0 0 0 1px var(--green-soft) inset, var(--shadow); }
.inq-msg { margin-top: 10px; padding: 11px 13px; background: #f7faf7; border-radius: 12px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.nav-badge { min-width: 19px; padding: 1px 6px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; text-align: center; }

/* ---------- account page ---------- */
.danger-card { border-color: #f0cfc9; }
.danger-title { color: var(--danger); }
.auth-alt { text-align: center; margin-top: 12px; font-size: 12.5px; }
.auth-alt a { color: var(--muted); }

/* onboarding empty state */
.onboard { grid-column: 1 / -1; background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); padding: 34px 28px; text-align: center; box-shadow: var(--shadow); }
.onboard-icon { font-size: 40px; margin-bottom: 10px; }
.onboard h3 { font-size: 19px; margin-bottom: 6px; }
.onboard-steps { text-align: left; max-width: 380px; margin: 16px auto 20px; color: var(--muted); font-size: 13.5px; line-height: 1.9; padding-left: 20px; }

/* ---------- native shell / mobile safe areas ----------
   Inside a Capacitor WebView the layout runs edge to edge, so the status bar
   and the home indicator would overlap our chrome without these insets. */
@supports (padding: max(0px)) {
  .sidebar { padding-top: max(20px, env(safe-area-inset-top)); }
  .main { padding-bottom: max(30px, env(safe-area-inset-bottom)); }
  .auth-body { padding-top: max(24px, env(safe-area-inset-top)); padding-bottom: max(24px, env(safe-area-inset-bottom)); }
  @media (max-width: 860px) {
    .sidebar { padding-top: max(12px, env(safe-area-inset-top)); }
    .lang-switch { top: max(14px, calc(env(safe-area-inset-top) + 2px)); }
  }
}
/* a native app should not feel like a web page: no text auto-zoom, no
   long-press callout, no rubber-band selection on chrome */
html { -webkit-text-size-adjust: 100%; }
body { -webkit-touch-callout: none; overscroll-behavior-y: none; }
.btn, .nav-btn, .day-chip, .icon-chip, .step-btn, .lang-btn, .preset-btn, .cal-cell {
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
/* iOS zooms the page when focusing an input smaller than 16px. Only bump the
   size where that actually happens, so the desktop layout stays as designed. */
@media (max-width: 860px) {
  input, select, textarea { font-size: 16px; }
}

/* Installer working inside a customer's garden. Deliberately loud: acting on
   someone else's data must never feel like acting on your own. */
.acting-banner {
  background: #fbf1dd; border: 1px solid #f0dcae; color: #7a5410;
  padding: 10px 16px; border-radius: 12px; margin-bottom: 18px;
  font-size: 13.5px; font-weight: 600;
}

/* ---------- touch input ----------
   A finger has no hover. Tapping a chip leaves :hover applied until something
   else is touched, and several of our hover styles are the same green as the
   selected state, so a tapped day or zone kept looking chosen when it was not.
   Fingers get no hover styling at all; a mouse keeps it. */
@media (hover: none) {
  .day-chip:hover, .icon-chip:hover, .preset-btn:hover, .cal-arrow:hover,
  .loc-item:hover, .lang-opt:hover, .auth-lang .lang-opt:hover, .lang-current:hover {
    background: inherit; border-color: var(--line); color: inherit;
  }
  .cal-cell:hover:not(.empty):not(.future):not(.edge):not(.band) { background: transparent; }
  .kpi-click:hover { transform: none; box-shadow: var(--shadow); }
  .btn:hover, .btn.primary:hover, .btn.blue:hover { filter: none; }
}

/* A 12-hour clock needs room for "10:00 PM"; narrower than this the suffix is
   cut off on any phone set to English. */
#nf-quiet-from, #nf-quiet-to { min-width: 128px; }

/* On a narrow phone the schedule row does not fit on one line: five things in
   300 points. Time and days stay together on the first line; the rain chip and
   the buttons drop to a second, full-width line instead of crushing the text
   word by word and pushing the delete button off the screen. */
@media (max-width: 480px) {
  .sch-row { flex-wrap: wrap; gap: 8px 10px; }
  .sch-row::after { content: ''; flex-basis: 100%; height: 0; order: 2; }
  .sch-time { order: 0; width: auto; }
  .sch-days { order: 1; flex: 1 1 0; min-width: 0; }
  .sch-row .tag { order: 3; white-space: nowrap; }
  .sch-row .btn { order: 4; }
  .sch-row .btn.danger-text { margin-left: auto; }
  /* the page title and its action button stack instead of sharing a line */
  .view-head.row { flex-direction: column; align-items: stretch; gap: 10px; }
  .view-head.row .btn { align-self: flex-start; }
}

/* =====================================================================
   Design pass, September 2026.
   One visual language for app and website: line icons instead of emoji,
   pill-shaped controls, generous radii, layered soft shadows, tinted icon
   tiles, tighter display type. Colours stay exactly as they were: every
   text/background pair below is covered by the contrast test.
   ===================================================================== */
:root {
  --radius: 20px;
  --radius-sm: 14px;
  --pill: 999px;
  --shadow-sm: 0 1px 2px rgba(20,40,30,.04), 0 1px 1px rgba(20,40,30,.03);
  --shadow: 0 1px 2px rgba(20,45,32,.04), 0 6px 18px rgba(20,45,32,.06);
  --shadow-lg: 0 8px 20px rgba(18,40,28,.10), 0 24px 48px rgba(18,40,28,.14);
  --ring: 0 0 0 3px rgba(31,157,85,.22);
}

/* type */
h1 { font-size: 26px; font-weight: 800; letter-spacing: -.7px; }
.brand-name { font-weight: 800; letter-spacing: -.5px; }
.kpi-big, .weather-temp, .sch-time { font-variant-numeric: tabular-nums; }
.weather-temp { font-size: 50px; letter-spacing: -2.5px; }
.section-title { letter-spacing: 1.1px; font-size: 11.5px; }

/* icons drawn by the app, never by the font */
.zi { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
.zi svg { width: 22px; height: 22px; display: block; }
.zi-inline svg { width: 16px; height: 16px; vertical-align: -3px; }
.ic svg { vertical-align: -3px; }
.rain-banner .ic svg, .rp-text .ic svg, .tag .ic svg, .skip-note .ic svg { width: 15px; height: 15px; }
.weather-offline .ic svg { width: 18px; height: 18px; }

/* zone icon as a tinted tile */
.zone-icon {
  width: 42px; height: 42px; border-radius: 13px; background: var(--green-soft); color: var(--green-dark);
  font-size: 0; display: grid; place-items: center;
}
.zone-card.watering .zone-icon { background: #e3edf7; color: var(--blue); }
.zone-card.waiting .zone-icon { background: #fbf1dd; color: #9a6b12; }
.zone-icon .drip { color: var(--blue); }
.zone-icon .drip svg { width: 12px; height: 12px; }
.onboard-icon { width: 64px; height: 64px; border-radius: 20px; background: var(--green-soft); color: var(--green-dark); display: grid; place-items: center; margin: 0 auto 14px; font-size: 0; }
.onboard-icon .zi svg { width: 32px; height: 32px; }

/* the icon picker */
.icon-chip { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; color: var(--muted); font-size: 0; }
.icon-chip.on { color: var(--green-dark); }

/* pills */
.btn { border-radius: var(--pill); }
.btn.sm { border-radius: var(--pill); }
.badge, .tag, .hw-tag, .day-chip, .preset-btn { border-radius: var(--pill); }
.tag { padding: 4px 10px; display: inline-flex; align-items: center; gap: 5px; }
.hw-tag { padding: 3px 8px; }

/* language: a globe and a code, no flag */
.lang-current .flag { display: inline-flex; color: var(--green-dark); line-height: 0; }
.lang-current .flag svg { width: 16px; height: 16px; }
.lang-opt .flag, .table .flag, .flag {
  font-size: 10.5px; font-weight: 800; letter-spacing: .6px; padding: 2px 6px; border-radius: 6px;
  background: var(--green-soft); color: var(--green-dark); font-family: inherit;
}
.lang-current .flag { background: none; padding: 0; }

/* surfaces */
.card, .zone-card, .kpi, .auth-card, .modal, .onboard { border-radius: var(--radius); }
.kpi { padding: 16px 18px; }
.kpi::before { left: 18px; right: auto; top: 14px; bottom: auto; width: 26px; height: 4px; border-radius: 2px; }
.kpi-label { margin-top: 12px; }
.kpi-plain::before { background: transparent; }
.kpi-plain .kpi-label { margin-top: 0; }
.rain-banner { border-radius: var(--radius-sm); padding: 10px 14px; display: flex; align-items: center; gap: 8px; }
.rain-prompt { border-radius: var(--radius); }
.hw-status { border-radius: var(--radius-sm); }
.field input:not([type=checkbox]):not([type=radio]), .field select { border-radius: 12px; }
.field input:focus, .field select:focus { outline: none; border-color: var(--green); box-shadow: var(--ring); }
.modal { border-radius: 24px; }
.auth-card { border-radius: 24px; }
.nav-btn.active { box-shadow: 0 8px 18px rgba(20,122,65,.24); }
@media (max-width: 860px) {
  .nav-btn.active { box-shadow: none; }
}

/* No accent bars on the KPI tiles: one tile with a bar and three without put
   the labels on different baselines. The number carries the emphasis. */
.kpi::before { display: none; }
.kpi-label { margin-top: 0; }

/* the plan card */
.plan-line { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.plan-big { font-size: 26px; font-weight: 800; letter-spacing: -.6px; font-variant-numeric: tabular-nums; }
.err-text { color: var(--danger); }
