/* Hydrega web app — minimal, fast, system-font. Always light (no dark mode). No framework. */
:root {
  --bg: #f5f6f8; --card: #ffffff; --fg: #14181f; --muted: #5b6573; --line: #e2e6ec;
  --accent: #1f7a4d; --accent-fg: #fff; --danger: #c23a2b; --warn: #b8860b;
  --on: #1f7a4d; --radius: 12px; --maxw: 880px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--fg);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[x-cloak] { display: none !important; }
.app { max-width: var(--maxw); margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }

header.bar {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 5;
}
header.bar .title { font-weight: 600; font-size: 16px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
header.bar .back { background: none; border: 0; color: var(--accent); font-size: 15px; cursor: pointer; padding: 4px; white-space: nowrap; }
header.bar nav.row { flex-wrap: wrap; }
header.bar .account { margin-left: auto; align-items: center; gap: 10px; }
header.bar .account .email { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
main { padding: 16px; flex: 1; }

/* Mobile: let the header collapse gracefully down to ~360px. The nav wraps to its own full-width
   row beneath the title; the account email is hidden (the Sign out button remains). */
@media (max-width: 560px) {
  header.bar { gap: 8px 10px; padding: 10px 12px; }
  header.bar .title { font-size: 15px; flex: 1 1 auto; }
  header.bar nav.row { order: 3; flex-basis: 100%; gap: 0 14px; margin-top: 2px; }
  header.bar nav.row a { margin-left: 0 !important; }
  header.bar .account { order: 2; }
  header.bar .account .email { display: none; }
}

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card h2 { margin: 0 0 10px; font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-variant-numeric: tabular-nums; }
.big { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }

button { font: inherit; cursor: pointer; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--card); color: var(--fg);
  border-radius: 10px; padding: 10px 14px; font-weight: 500;
  white-space: nowrap;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.btn.danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn.block { width: 100%; }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn.ghost { background: none; border-color: var(--line); }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); }
.pill.on { color: var(--on); border-color: var(--on); }
.pill.off { color: var(--muted); }
.pill.warn { color: var(--warn); border-color: var(--warn); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.online { background: var(--accent); }
.dot.offline { background: var(--danger); }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=time], select {
  font: inherit; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--card); color: var(--fg); width: 100%;
}
input[type=text]:focus, input[type=email]:focus, input[type=password]:focus,
input[type=number]:focus, input[type=time]:focus, select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 122, 77, 0.18);
}
label.field { display: block; margin-bottom: 10px; }
label.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input[type=range] { width: 100%; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }

/* Searchable timezone combobox */
.combo { position: relative; }
.combo-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 40;
  margin: 0; padding: 4px; list-style: none; max-height: 280px; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 9px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}
.combo-list li { padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.combo-list li.active { background: var(--accent); color: var(--accent-fg); }

.list-item { display: flex; align-items: center; gap: 12px; padding: 14px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .name { font-weight: 600; }

.chip { border: 1px solid var(--line); background: var(--card); color: var(--fg); border-radius: 999px; padding: 6px 12px; font-size: 13px; }
.chip.sel { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.chip:disabled { opacity: .4; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; background: var(--fg); color: var(--bg);
  padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 50; max-width: 90%; }
.error { color: var(--danger); font-size: 13px; }

.zone-edit { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.zone-edit:last-child { border-bottom: 0; }
.zone-edit .order { width: 22px; color: var(--muted); font-size: 13px; text-align: center; }
.zone-edit input[type=number] { width: 70px; }
.arrows { display: flex; flex-direction: column; }
.arrows button { background: none; border: 0; color: var(--accent); font-size: 12px; line-height: 1; padding: 2px 4px; }

/* "Coming up" day-view timelines (Status). SVG renders the runs; this just spaces the two days. */
.timeline-day { margin-top: 8px; }
.timeline-day + .timeline-day { margin-top: 14px; }
.timeline-label { margin-bottom: 4px; font-weight: 600; }

footer.modebar { padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted);
  display: flex; align-items: center; gap: 8px; }
.center { text-align: center; }
.gsi { display: inline-flex; align-items: center; gap: 10px; background: #fff; color: #1f1f1f; border: 1px solid #dadce0;
  border-radius: 10px; padding: 11px 18px; font-weight: 500; font-size: 15px; }
.gsi svg { width: 18px; height: 18px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { background: var(--card); border: 0; padding: 6px 12px; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg button.sel { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
.seg button + button { border-left: 1px solid var(--line); }
.cal { border: 1px solid var(--line); border-radius: 10px; max-height: 480px; overflow-y: auto; background: #f8fafb; }
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: sp 0.7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
