@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@500;600;700;800&display=swap");

:root {
  --bg: #e8eef4;
  --card: #fff;
  --text: #1b2433;
  --muted: #6b7a8d;
  --line: #d8e1ea;
  --ok: #1a9a62;
  --off: #d4533a;
  --accent: #e56a2e;
  --green: #2f9d5b;
  --blue: #2f7ed8;
  --orange: #e56a2e;
  --purple: #6d5bd0;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Manrope, "Segoe UI", sans-serif;
}
body { padding-bottom: env(safe-area-inset-bottom); }

.shell {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 14px 8px;
  background: #fff;
}
.brand-logo {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  box-shadow: 0 0 0 1px #eee;
}
.brand-name {
  font-weight: 800;
  font-size: 16px;
  letter-spacing: .02em;
}
.brand-sub {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.view { flex: 1; padding: 8px 14px 88px; }

.welcome {
  background: var(--card);
  border-radius: 20px;
  padding: 12px 16px 10px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(27, 36, 51, .05);
  margin-bottom: 12px;
}
.welcome img {
  width: 176px;
  height: 176px;
  border-radius: 36px;
  object-fit: cover;
  margin-bottom: 8px;
}
.welcome p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.35; }

.h-sec {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  margin: 8px 4px 10px;
}

.search {
  width: 100%;
  border: 0;
  background: #fff;
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  margin-bottom: 12px;
  box-shadow: 0 4px 14px rgba(27, 36, 51, .04);
}

.obj {
  width: 100%;
  border: 0;
  background: #fff;
  border-radius: 16px;
  padding: 14px 14px 14px 16px;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  font: inherit;
  margin-bottom: 10px;
  box-shadow: 0 6px 16px rgba(27, 36, 51, .05);
  position: relative;
  overflow: hidden;
}
.obj::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--off);
}
.obj.on::before { background: var(--ok); }
.ico {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: grid; place-items: center;
  font-size: 26px;
}
.ico.lock { background: #e8f7ef; }
.ico.open { background: #fde8df; }
.obj b { display: block; font-size: 15px; }
.obj .muted { color: var(--muted); font-size: 12px; line-height: 1.35; }
.chip {
  font-size: 13px;
  font-weight: 800;
  padding: 8px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.chip.on { background: #e8f7ef; color: var(--ok); }
.chip.off { background: #fde8df; color: var(--off); }

.status-card {
  position: relative;
  background: #fff;
  border-radius: 18px;
  padding: 16px 14px 14px;
  text-align: center;
  box-shadow: 0 6px 16px rgba(27, 36, 51, .05);
  margin-bottom: 10px;
}
.status-card .lock { font-size: 42px; line-height: 1; }
.status-card .st {
  margin: 6px 0 8px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .06em;
}
.status-card .st.on { color: var(--accent); }
.status-card .st.off { color: var(--off); }
.status-card .oname { font-size: 15px; font-weight: 700; margin-top: 2px; }
.status-card .addr { color: var(--muted); font-size: 13px; margin-top: 4px; letter-spacing: .02em; }
.status-card .when { color: var(--muted); font-size: 12px; margin-top: 4px; }
.status-card .tap { color: #9aa8b6; font-size: 12px; margin-top: 10px; }
.online {
  position: absolute;
  top: 10px;
  right: 12px;
  color: var(--ok);
  font-size: 12px;
  font-weight: 700;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.tile {
  border: 0;
  border-radius: 22px;
  min-height: 126px;
  color: #fff;
  font: inherit;
  font-weight: 800;
  letter-spacing: .04em;
  padding: 14px 12px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
  transform: translateY(0);
  transition: transform .12s ease, box-shadow .12s ease;
}
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.28), rgba(255,255,255,0) 42%);
  pointer-events: none;
}
.ico3d {
  width: 58px;
  height: 58px;
  object-fit: contain;
  filter: drop-shadow(0 6px 8px rgba(0,0,0,.22));
  position: relative;
  z-index: 1;
}
.tile:active {
  transform: translateY(3px) scale(.985);
}
.tile b { display: block; font-size: 14px; position: relative; z-index: 1; }
.tile small { display: block; font-weight: 600; opacity: .82; font-size: 11px; position: relative; z-index: 1; }
.t-green {
  background: linear-gradient(180deg, #46c478, #2a9a55);
  box-shadow: 0 10px 18px rgba(32, 120, 70, .22);
}
.t-green:active { box-shadow: 0 4px 10px rgba(32, 120, 70, .18); }
.t-blue {
  background: linear-gradient(180deg, #5a9aec, #2f74c9);
  box-shadow: 0 10px 18px rgba(40, 90, 170, .22);
}
.t-blue:active { box-shadow: 0 4px 10px rgba(40, 90, 170, .18); }
.t-orange {
  background: linear-gradient(180deg, #f28648, #d45a24);
  box-shadow: 0 10px 18px rgba(180, 70, 30, .22);
}
.t-orange:active { box-shadow: 0 4px 10px rgba(180, 70, 30, .18); }
.t-purple {
  background: linear-gradient(180deg, #8a76e0, #5b49b6);
  box-shadow: 0 10px 18px rgba(80, 60, 160, .22);
}
.t-purple:active { box-shadow: 0 4px 10px rgba(80, 60, 160, .18); }

.back {
  border: 0; background: none; color: var(--muted);
  font: inherit; padding: 0 0 10px; cursor: pointer;
}

.card {
  background: #fff;
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(27, 36, 51, .05);
}
.card h2 { margin: 0 0 6px; font-size: 17px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; }

.seg {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  background: #eef2f6;
  border-radius: 12px;
  padding: 4px;
  margin-top: 14px;
}
.seg button {
  border: 0; background: none; font: inherit; font-weight: 700;
  padding: 8px 4px; border-radius: 9px; color: var(--muted);
}
.seg button.on { background: var(--accent); color: #fff; }

.btn {
  width: 100%;
  border: 0;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 800;
  padding: 14px 16px;
  border-radius: 14px;
  margin-top: 12px;
}
.btn.ghost { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn.warn { background: #f3d6d1; color: var(--off); }
.btn[disabled] { opacity: .7; }

.field { margin: 14px 0 8px; }
.field span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
input[type="tel"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
}
.err { color: #b42318; font-size: 13px; min-height: 18px; }

.note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 430px;
  background: #fff;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 18px rgba(27, 36, 51, .06);
}
.tabbar button {
  border: 0; background: none; font: inherit;
  color: var(--muted); font-size: 10px; font-weight: 700;
  transform: translateY(0);
  transition: transform .08s ease;
}
.tabbar button:active { transform: translateY(3px); }
.tabbar button.on { color: var(--accent); }
.ti {
  display: block;
  width: 26px;
  height: 26px;
  margin: 0 auto 3px;
  border-radius: 8px;
  background-size: 22px 22px;
  background-repeat: no-repeat;
  background-position: center;
  filter: drop-shadow(0 2px 1px rgba(0,0,0,.18));
}
.ti-home { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23e56a2e' d='M12 3.2 3 11h2.2v8.5h5.1V14h3.4v5.5h5.1V11H21z'/></svg>"); }
.ti-shield { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%232f7ed8' d='M12 2 5 5.2v6.2c0 4.5 3 8.3 7 9.6 4-1.3 7-5.1 7-9.6V5.2z'/><path fill='%23fff' d='M10.3 15.3 7.8 12.8l1.2-1.2 1.3 1.3 4-4 1.2 1.2z'/></svg>"); }
.ti-bell { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23e6b325' d='M12 3a6 6 0 0 0-6 6v3.2L4.2 15h15.6L18 12.2V9a6 6 0 0 0-6-6zm0 18a2.4 2.4 0 0 0 2.3-1.6H9.7A2.4 2.4 0 0 0 12 21z'/></svg>"); }
.ti-kts { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><circle cx='12' cy='13' r='6.2' fill='%23e23b3b'/><circle cx='12' cy='13' r='3.1' fill='%23ffd4d0'/><path fill='%23e23b3b' d='M11.1 3h1.8v3.2h-1.8z'/><path fill='%23e23b3b' d='M4.2 6.2 5.5 5l2.2 2.2-1.3 1.2zM19.8 6.2 18.5 5l-2.2 2.2 1.3 1.2z'/></svg>"); }
.ti-case { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23815a36' d='M9 6V4.6A1.6 1.6 0 0 1 10.6 3h2.8A1.6 1.6 0 0 1 15 4.6V6h5v13H4V6zm2 .1V5h2v1.1z'/></svg>"); }
.tabbar button.on .ti { filter: drop-shadow(0 3px 2px rgba(229,106,46,.35)); }

/* ── вариант 1: радар (классика плиток сохранена выше) ── */
.obj-line {
  text-align: center;
  margin: 2px 8px 12px;
}
.obj-line b { display: block; font-size: 16px; }
.obj-line span { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }

.radar-wrap { display: flex; justify-content: center; padding: 2px 0 6px; }
.hero-status + .radar-wrap .radar { width: min(82vw, 300px); }
.radar {
  --metal: #1c2433;
  --ring: #2d384c;
  --amber: #d4a24a;
  position: relative;
  width: min(86vw, 328px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #243044 0 38%, transparent 39%),
    repeating-radial-gradient(circle at 50% 50%, transparent 0 18px, rgba(212,162,74,.07) 18px 19px),
    conic-gradient(from 0deg, #1a2130, #2a3348 25%, #1a2130 50%, #2a3348 75%, #1a2130);
  box-shadow:
    inset 0 0 0 10px #141a26,
    inset 0 0 0 12px rgba(212,162,74,.28),
    0 18px 40px rgba(20, 26, 38, .35);
  overflow: hidden;
}
.radar.armed { box-shadow:
  inset 0 0 0 10px #141a26,
  inset 0 0 0 12px rgba(212,162,74,.55),
  0 0 28px rgba(212,162,74,.22),
  0 18px 40px rgba(20, 26, 38, .35);
}
.radar-grid {
  position: absolute; inset: 0;
  background:
    linear-gradient(90deg, transparent 49.4%, rgba(212,162,74,.18) 49.4% 50.6%, transparent 50.6%),
    linear-gradient(0deg, transparent 49.4%, rgba(212,162,74,.18) 49.4% 50.6%, transparent 50.6%);
  pointer-events: none;
}
.radar-sweep {
  position: absolute; inset: 0;
  background: conic-gradient(from 0deg, transparent 0 78%, rgba(212,162,74,.32) 92%, transparent 100%);
  animation: sweep 4.8s linear infinite;
  pointer-events: none;
}
@keyframes sweep { to { transform: rotate(360deg); } }

.sec {
  position: absolute;
  width: 50%;
  height: 50%;
  border: 0;
  margin: 0;
  color: #e8eef6;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 18% 10% 8%;
}
.sec i { display: block; width: 22px; height: 22px; }
.sec i svg { width: 22px; height: 22px; fill: #f0d59a; }
.sec:active { background: rgba(212,162,74,.14); }
.s-nw { top: 0; left: 0; border-radius: 100% 0 0 0; padding-bottom: 12%; padding-right: 8%; }
.s-ne { top: 0; right: 0; border-radius: 0 100% 0 0; padding-bottom: 12%; padding-left: 8%; }
.s-sw { bottom: 0; left: 0; border-radius: 0 0 0 100%; padding-top: 14%; padding-right: 8%; justify-content: flex-start; }
.s-se { bottom: 0; right: 0; border-radius: 0 0 100% 0; padding-top: 14%; padding-left: 8%; justify-content: flex-start; }

.hub {
  position: absolute;
  inset: 29%;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 32%, #3a465c, #151b28 72%);
  color: #f3e6c4;
  box-shadow: inset 0 0 0 2px rgba(212,162,74,.45), 0 8px 18px rgba(0,0,0,.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
  font: inherit;
}
.hub strong { font-size: 11px; letter-spacing: .08em; line-height: 1.2; }
.hub small { color: #8b97a8; font-size: 9px; margin-top: 4px; }
.hub-lock { display: block; width: 28px; height: 28px; margin-bottom: 4px; }
.hub-lock svg { width: 28px; height: 28px; fill: #7dcea0; }
.radar.idle .hub-lock svg { fill: #e8b4a8; }
.radar.idle .hub strong { color: #e8b4a8; }
.blip {
  width: 10px; height: 10px; border-radius: 50%;
  background: #d4a24a;
  box-shadow: 0 0 10px #d4a24a;
  margin-bottom: 6px;
}
.radar.idle .blip { background: #c45c4a; box-shadow: 0 0 10px #c45c4a; }

/* ── вариант 2: пульт ── */
.deck {
  display: block;
  width: 100%;
  border: 0;
  text-align: left;
  font: inherit;
  color: #e8eef4;
  border-radius: 18px;
  padding: 14px 16px 16px;
  background:
    linear-gradient(180deg, #2c3444, #1a202c);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.12),
    inset 0 -2px 8px rgba(0,0,0,.35),
    0 10px 22px rgba(20, 26, 36, .18);
  margin-bottom: 14px;
}
.deck-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.lamp {
  width: 9px; height: 9px; border-radius: 50%;
  background: #c45c4a;
  box-shadow: 0 0 8px #c45c4a;
}
.deck.armed .lamp { background: #d4a24a; box-shadow: 0 0 8px #d4a24a; }
.deck-st {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .12em;
  flex: 1;
}
.deck.armed .deck-st { color: #e8d5a6; }
.deck.idle .deck-st { color: #efc4bc; }
.deck-live { color: #7d8b9c; font-size: 11px; font-weight: 700; }
.deck-name { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
.deck-meta { color: #9aa6b5; font-size: 12px; line-height: 1.4; }

.keys {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 10px;
  border-radius: 18px;
  background: #d8dee6;
  box-shadow: inset 0 2px 8px rgba(40, 50, 64, .18);
}
.key {
  border: 0;
  border-radius: 14px;
  min-height: 86px;
  font: inherit;
  color: #2a3344;
  background: linear-gradient(180deg, #f4f6f8, #c9d0d8);
  box-shadow:
    inset 0 1px 0 #fff,
    0 3px 0 #9aa3ae,
    0 6px 10px rgba(40, 50, 64, .16);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transform: translateY(0);
  transition: transform .1s ease, box-shadow .1s ease;
}
.key i { display: block; width: 22px; height: 22px; }
.key i svg { width: 22px; height: 22px; fill: #3a4658; }
.key b { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.key:active {
  transform: translateY(3px);
  box-shadow: inset 0 2px 6px rgba(40, 50, 64, .25), 0 1px 0 #9aa3ae;
}
.key-kts {
  background: linear-gradient(180deg, #f6ece6, #d8c4b8);
}
.key-kts i svg { fill: #8a3d2c; }
.key-kts b { color: #7a3426; }

/* ── вариант 3: одна главная, три планки ── */
.hero-status {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  border: 0;
  text-align: left;
  font: inherit;
  background: #fff;
  border-radius: 18px;
  padding: 12px 14px 12px 12px;
  box-shadow: 0 6px 16px rgba(27, 36, 51, .05);
  margin-bottom: 12px;
}
.hero-copy { flex: 1; min-width: 0; }
.hero-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.hero-st {
  flex: 1;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .12em;
}
.hero-lock {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #f4fff8, #d4f0e0);
  box-shadow:
    inset 0 2px 0 #fff,
    inset 0 -4px 8px rgba(26, 154, 98, .16),
    0 8px 16px rgba(26, 154, 98, .2);
}
.hero-lock svg { width: 50px; height: 50px; display: block; }
.hero-status.armed .hero-st { color: var(--ok); }
.hero-status.idle .hero-st { color: var(--off); }
.hero-status.idle .hero-lock {
  background: linear-gradient(180deg, #fff7f4, #f6d8d0);
  box-shadow:
    inset 0 2px 0 #fff,
    inset 0 -4px 8px rgba(212, 83, 58, .16),
    0 8px 16px rgba(212, 83, 58, .18);
}
.live {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.live.on { color: var(--ok); }
.live.off { color: #9aa6b4; }
.hero-name { font-size: 18px; font-weight: 800; }
.hero-meta { color: var(--muted); font-size: 12px; line-height: 1.4; margin-top: 3px; }
.hero-hint {
  color: #9aa6b4;
  font-size: 11px;
  font-weight: 600;
  margin-top: 6px;
}

.hero-main {
  width: 100%;
  border: 0;
  border-radius: 22px;
  min-height: 148px;
  padding: 22px 18px 20px;
  font: inherit;
  color: #fff;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  margin-bottom: 12px;
  box-shadow: 0 12px 22px rgba(32, 120, 70, .22);
  transform: translateY(0);
  transition: transform .12s ease, box-shadow .12s ease;
}
.hero-main.armed {
  background: linear-gradient(180deg, #3fbe6e, #2a9a55);
}
.hero-main.idle {
  background: linear-gradient(180deg, #5a6778, #3d4756);
  box-shadow: 0 12px 22px rgba(40, 50, 64, .18);
}
.hero-main:active {
  transform: translateY(3px) scale(.99);
  box-shadow: 0 4px 10px rgba(32, 120, 70, .16);
}
.hero-ico {
  width: 42px;
  height: 42px;
  margin-bottom: 14px;
  display: grid;
  place-items: center;
}
.hero-ico svg { width: 36px; height: 36px; fill: #fff; }
.hero-main b { font-size: 28px; letter-spacing: .04em; line-height: 1; }
.hero-main small { display: block; margin-top: 6px; font-size: 13px; font-weight: 600; opacity: .88; }

.rails { display: grid; gap: 8px; }
.rail {
  width: 100%;
  border: 0;
  background: #fff;
  border-radius: 14px;
  min-height: 56px;
  padding: 0 16px;
  font: inherit;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  box-shadow: 0 4px 12px rgba(27, 36, 51, .04);
}
.rail i { display: block; width: 22px; height: 22px; flex: 0 0 22px; }
.rail i svg { width: 22px; height: 22px; fill: #3a4658; }
.rail span { flex: 1; font-size: 15px; font-weight: 700; }
.rail::after {
  content: "›";
  color: #b4bec8;
  font-size: 22px;
  line-height: 1;
}
.rail:active { background: #f3f6f9; }
.rail-kts i svg { fill: #c45c4a; }
.rail-kts span { color: #7a3426; }
