:root {
  --bg: #0e1614;
  --bg-2: #15201c;
  --card: #1b2a25;
  --card-2: #22332e;
  --line: #2d433c;
  --text: #e8f0ed;
  --muted: #8aa39a;
  --teal: #7ec8b8;
  --teal-dim: #3d7a6e;
  --gold: #c9a46a;
  --warn: #d4a056;
  --crit: #d66a5c;
  --ok: #7ec8b8;
  --shadow: 0 8px 24px rgba(0,0,0,.28);
  --radius: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  font-family: "SF Pro Text", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); min-height: 100%; }
body { -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
a { color: var(--teal); }

.app { min-height: 100dvh; display: flex; flex-direction: column; padding-bottom: calc(72px + var(--safe-bot)); }
.top {
  position: sticky; top: 0; z-index: 10;
  background: linear-gradient(180deg, #0e1614 70%, transparent);
  padding: calc(14px + var(--safe-top)) 20px 12px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; flex-direction: column; gap: 2px; }
.brand h1 { font-size: 18px; font-weight: 650; margin: 0; letter-spacing: .01em; }
.brand .sub { font-size: 12px; color: var(--muted); }
.icon-btn {
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer;
}
.main { padding: 0 16px 24px; display: flex; flex-direction: column; gap: 14px; max-width: 720px; width: 100%; margin: 0 auto; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.prop-name { font-size: 17px; font-weight: 650; margin: 0; }
.badge { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--card-2); color: var(--muted); }
.badge.warn { background: #3a2c16; color: var(--warn); }
.badge.crit { background: #3a1e1b; color: var(--crit); }
.badge.ok { background: #1a332e; color: var(--teal); }

.temps { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.temp-block { background: var(--card-2); border-radius: 12px; padding: 12px; }
.temp-block .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.temp-block .val { font-size: 28px; font-weight: 650; letter-spacing: -.03em; margin-top: 2px; }
.temp-block .meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.kpi { font-size: 13px; color: var(--muted); }
.kpi b { color: var(--text); font-weight: 600; }

.alert { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.alert:last-child { border-bottom: 0; padding-bottom: 0; }
.alert:first-child { padding-top: 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: 0 0 8px; background: var(--warn); }
.dot.crit { background: var(--crit); }
.alert h3 { margin: 0; font-size: 14px; font-weight: 600; }
.alert p { margin: 3px 0 0; font-size: 12px; color: var(--muted); }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: #121c19; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(8px + var(--safe-bot));
}
.nav button {
  background: none; border: 0; color: var(--muted); display: flex; flex-direction: column;
  align-items: center; gap: 2px; padding: 8px 0; font-size: 11px; cursor: pointer;
}
.nav button.active { color: var(--teal); }

/* Auth */
.auth {
  min-height: 100dvh; display: flex; flex-direction: column; justify-content: center;
  padding: calc(24px + var(--safe-top)) 24px calc(32px + var(--safe-bot));
  max-width: 420px; margin: 0 auto;
}
.auth .mark { width: 56px; height: 56px; margin-bottom: 16px; }
.auth h1 { font-size: 26px; margin: 0 0 6px; }
.auth p.lead { color: var(--muted); margin: 0 0 24px; font-size: 15px; line-height: 1.45; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--muted); }
.field input {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 14px; font-size: 16px; outline: none;
}
.field input:focus { border-color: var(--teal-dim); }
.primary {
  width: 100%; background: var(--teal); color: #0e1614; border: 0; border-radius: 12px;
  padding: 14px; font-weight: 650; font-size: 16px; cursor: pointer;
}
.primary:disabled { opacity: .5; }
.linkish { background: none; border: 0; color: var(--teal); padding: 12px 0; cursor: pointer; font-size: 14px; }
.err { color: var(--crit); font-size: 14px; margin: 0 0 12px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 16px; line-height: 1.4; }

.stay { padding: 10px 0; border-bottom: 1px solid var(--line); }
.stay:last-child { border: 0; }
.stay .when { font-size: 13px; color: var(--muted); margin-top: 2px; }
.activity { font-size: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.activity .when { font-size: 12px; color: var(--muted); margin-top: 2px; }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }

.back { background: none; border: 0; color: var(--teal); font-size: 15px; padding: 0; cursor: pointer; margin-bottom: 8px; }
.settings-block { margin-bottom: 8px; }
.settings-block pre {
  white-space: pre-wrap; word-break: break-word; font-size: 12px; color: var(--muted);
  background: var(--bg-2); border-radius: 12px; padding: 12px; overflow: auto; max-height: 50vh;
}

.add-home {
  margin-top: 8px; font-size: 13px; color: var(--muted); background: var(--card-2);
  border-radius: 12px; padding: 12px; line-height: 1.45;
}
.hidden { display: none !important; }
