/* ═══ Розумний дім — мобільний вебзастосунок (дизайн: Claude Design) ═══
   Темна тема, одна колонка ~430px, центрована на десктопі.
   Значення кольорів статичні (одна тема) — див. :root нижче.
   Динаміку (дуга термостата, кольори режимів) виставляє app.js. */

:root {
  --bg: #0a0c10;
  --panel: #14181f;
  --panel2: #1d222b;
  --border: rgba(255, 255, 255, .08);
  --sw-off: #39414f;
  --text: #eef1f5;
  --muted: #98a2b0;
  --faint: #616b78;
  --accent: #5b8def;
  --accent-bg: rgba(91, 141, 239, .16);
  --on: #3ecf8e;
  --danger: #e5484d;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
button { font-family: inherit; color: inherit; }
html, body { min-height: 100vh; }
body {
  -webkit-font-smoothing: antialiased;
  font-family: Manrope, system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: radial-gradient(120% 78% at 50% -8%, #212633, #0b0d11 68%);
}
::-webkit-scrollbar { width: 0; height: 0; }
.mono { font-family: 'IBM Plex Mono', monospace; }

/* ── Каркас «телефон» ── */
.phone {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
@media (min-width: 472px) {
  body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 22px; }
  .phone {
    height: min(920px, calc(100vh - 44px));
    border-radius: 38px;
    border: 1px solid rgba(255, 255, 255, .05);
    box-shadow: 0 30px 90px rgba(0, 0, 0, .55);
  }
}

/* ── Екрани ── */
.view { padding: calc(env(safe-area-inset-top, 0px) + 18px) 18px 22px; display: flex; flex-direction: column; gap: 16px; }

/* ── Інфо-картки (час + кімната) ── */
.info-cards { display: grid; grid-template-columns: 1.15fr 1fr; gap: 12px; }
.info-card { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 13px 15px; }
.info-time {
  font-family: 'IBM Plex Mono', monospace; font-size: 27px; font-weight: 600;
  letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums;
}
.info-date { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-top: 5px; }
.info-room-cap { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.info-room-val {
  font-family: 'IBM Plex Mono', monospace; font-size: 27px; font-weight: 600;
  letter-spacing: -.02em; margin-top: 4px; line-height: 1;
}
.info-room-val .deg { font-size: 16px; color: var(--muted); }

/* ── Кондиціонер: круговий термостат ── */
.hero { background: var(--panel); border: 1px solid var(--border); border-radius: 26px; padding: 20px 18px 22px; transition: border-color .25s; }
.hero.on { border-color: rgba(91, 141, 239, .33); }
.hero-head { display: flex; align-items: center; justify-content: space-between; }
.hero-id { display: flex; align-items: center; gap: 12px; }
.hero-icon { width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: var(--panel2); }
.hero-icon.lit { background: var(--accent-bg); }
.hero-title { font-size: 16px; font-weight: 800; letter-spacing: -.01em; }
.hero-sub { font-size: 13px; color: var(--muted); margin-top: 1px; }

.power-btn {
  display: flex; align-items: center; gap: 7px; border-radius: 999px;
  padding: 9px 15px; font-size: 13px; font-weight: 700; cursor: pointer;
  background: var(--panel2); color: var(--muted); border: 1px solid var(--border); transition: all .2s;
}
.power-btn.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.power-btn:disabled { opacity: .6; cursor: default; }

.dial {
  position: relative; width: 236px; height: 236px; margin: 14px auto 6px;
  touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer;
}
.dial-svg { width: 100%; height: 100%; overflow: visible; display: block; }
.dial-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.dial-cap { font-size: 11px; letter-spacing: .18em; color: var(--faint); font-weight: 700; }
.dial-num {
  font-family: 'IBM Plex Mono', monospace; font-weight: 600; font-size: 62px;
  line-height: 1; letter-spacing: -.03em; color: var(--text); display: flex; align-items: baseline;
}
.dial-num.off { color: var(--faint); }
.dial-unit { font-size: 24px; color: var(--muted); font-weight: 500; }
.dial-room { display: flex; align-items: center; gap: 5px; margin-top: 6px; color: var(--muted); font-size: 12.5px; font-weight: 600; }

.dial-controls { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 2px; }
.round-btn {
  width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  cursor: pointer; background: var(--panel2); border: 1px solid var(--border); color: var(--text); flex-shrink: 0; padding: 0;
}
.round-btn:disabled { cursor: default; }
.dial-mode-label { min-width: 118px; text-align: center; }
.dml-mode { font-size: 15px; font-weight: 700; color: var(--text); }
.dml-mode.off { color: var(--faint); }
.dml-state { font-size: 11.5px; color: var(--faint); font-weight: 600; margin-top: 2px; }

.hero-modes { margin-top: 16px; }

/* ── Сегментовані ряди (режими / вентилятор / жалюзі) ── */
.seg-row { display: flex; gap: 5px; background: var(--panel2); border-radius: 16px; padding: 5px; }
.seg-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 9px 0; border-radius: 11px; cursor: pointer; border: 0; background: transparent;
  color: var(--muted); font-family: inherit; font-size: 11px; font-weight: 700;
}
.seg-btn.active { background: var(--accent-bg); color: var(--accent); }
.seg-btn.seg-plain { font-size: 13px; padding: 9px 0; }
.seg-label { font-size: 11px; font-weight: 700; }
.seg-btn.active .seg-label { color: var(--accent); }

/* ── Додаткові налаштування AC ── */
.extra { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.extra-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit;
}
.extra-toggle .left { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 700; color: var(--muted); }
.chev { display: inline-flex; transition: transform .2s; }
.chev.open { transform: rotate(180deg); }
.extra-body { display: flex; flex-direction: column; gap: 20px; margin-top: 20px; }
.group-label { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 10px; }

.feat-card { background: var(--panel2); border-radius: 14px; overflow: hidden; }
.feat-row { display: flex; align-items: center; justify-content: space-between; padding: 13px 15px; border-bottom: 1px solid var(--border); }
.feat-row:last-child { border-bottom: 0; }
.feat-label { font-size: 14.5px; font-weight: 600; }

/* ── Швидкий доступ (плитки) ── */
.section-label { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); font-weight: 700; margin: 4px 2px -2px; }
.tile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.tile {
  display: flex; flex-direction: column; justify-content: space-between; min-height: 116px;
  text-align: left; cursor: pointer; border-radius: 18px; padding: 15px;
  background: var(--panel); border: 1px solid var(--border); gap: 10px; font-family: inherit; color: var(--text);
  transition: border-color .2s;
}
.tile.on { border-color: rgba(91, 141, 239, .33); }
.tile-top { display: flex; align-items: center; justify-content: space-between; }
.tile-icon { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--panel2); transition: background .2s; }
.tile.on .tile-icon { background: var(--accent-bg); }
.tile-name { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.tile-room { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.tile-state { font-size: 12px; font-weight: 700; color: var(--faint); }
.tile-state.on { color: var(--on); }

/* ── Перемикачі ── */
.sw { display: inline-block; position: relative; width: 44px; height: 26px; border-radius: 999px; flex-shrink: 0; background: var(--sw-off); transition: background .2s; }
.sw .knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s; }
.sw.on { background: var(--accent); }
.sw.on .knob { transform: translateX(18px); }
.sw-btn { background: none; border: 0; padding: 0; cursor: pointer; flex-shrink: 0; }

/* ── Автоматизації ── */
.auto-head { margin-bottom: 2px; }
.auto-eyebrow { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.auto-h1 { font-size: 27px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.auto-card { background: var(--panel); border: 1px solid var(--border); border-radius: 22px; padding: 20px 18px; }
.warn-card { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; font-size: 13px; color: var(--muted); }
.card-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-id { display: flex; align-items: center; gap: 12px; }
.card-icon { width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: var(--panel2); flex-shrink: 0; }
.card-icon.lit { background: var(--accent-bg); }
.card-title { font-size: 16px; font-weight: 800; letter-spacing: -.01em; }
.card-sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }

.clim-body { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 14px; }
.step-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.step-label { font-size: 14px; font-weight: 600; color: var(--text); }
.step-ctrl { display: flex; align-items: center; gap: 10px; }
.step-btn { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; cursor: pointer; background: var(--panel2); border: 1px solid var(--border); color: var(--text); flex-shrink: 0; padding: 0; }
.step-val { font-family: 'IBM Plex Mono', monospace; font-size: 20px; font-weight: 600; min-width: 46px; text-align: center; }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; background: var(--panel2); border-radius: 14px; padding: 14px 15px; }
.opt-title { font-size: 14px; font-weight: 700; }
.opt-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.add-btn {
  display: flex; align-items: center; gap: 5px; border-radius: 999px; padding: 8px 14px 8px 11px;
  font-size: 13px; font-weight: 700; cursor: pointer; background: var(--accent-bg);
  border: 1px solid rgba(91, 141, 239, .33); color: var(--accent); flex-shrink: 0;
}
.sched-list { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.sched-item { background: var(--panel2); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; }
.sched-item.off { opacity: .5; }
.sched-row { display: flex; align-items: center; gap: 12px; }
.sched-time { font-family: 'IBM Plex Mono', monospace; font-size: 23px; font-weight: 600; letter-spacing: -.02em; min-width: 62px; }
.sched-info { flex: 1; min-width: 0; cursor: pointer; }
.sched-dev { font-size: 14.5px; font-weight: 700; }
.sched-desc { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.del-btn { width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px; display: flex; align-items: center; justify-content: center; cursor: pointer; background: transparent; border: 1px solid var(--border); color: var(--muted); padding: 0; transition: color .15s, border-color .15s; }
.del-btn:hover { color: var(--danger); border-color: rgba(229, 72, 77, .35); }

.sched-editor { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 12px; display: flex; flex-direction: column; gap: 12px; }
.sched-editor .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.sel, .num-in { background: var(--panel); border: 1px solid var(--border); color: var(--text); border-radius: 10px; padding: 7px 9px; font-size: 13px; font-family: inherit; }
.sel.mono, .num-in.mono { font-family: 'IBM Plex Mono', monospace; font-size: 15px; }
.num-in { width: 64px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 7px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; background: var(--panel); border: 1px solid var(--border); color: var(--text); }
.chip.active { background: var(--accent-bg); border-color: rgba(91, 141, 239, .33); color: var(--accent); }

.empty-note { text-align: center; padding: 30px 16px; color: var(--muted); font-size: 14px; }

/* ── Нижня навігація ── */
.bottom-nav {
  display: flex; z-index: 30; flex-shrink: 0;
  background: rgba(16, 19, 25, .9);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, .07);
  padding: 9px 12px calc(env(safe-area-inset-bottom, 0px) + 16px);
}
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; border: 0; background: none; cursor: pointer; font-size: 11px; font-weight: 600; color: var(--faint); }
.nav-item.active { color: var(--accent); font-weight: 700; }

/* ── Лоудер підключення ── */
.loader {
  position: absolute; inset: 0; z-index: 60;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px;
  background: radial-gradient(120% 80% at 50% 38%, #161b24, #0a0c10 72%);
  transition: opacity .35s;
}
.loader-spin { position: relative; width: 96px; height: 96px; display: flex; align-items: center; justify-content: center; }
.hub-ring { position: absolute; width: 96px; height: 96px; border-radius: 50%; border: 2px solid rgba(91, 141, 239, .5); animation: hub-ring 1.8s ease-out infinite; }
.hub-ring.d2 { animation-delay: .9s; }
.hub-rot { animation: hub-spin 1s linear infinite; }
.hub-wifi { position: absolute; display: flex; align-items: center; justify-content: center; color: var(--accent); animation: hub-pulse 1.6s ease-in-out infinite; }
.loader-text { text-align: center; animation: hub-fade .5s ease both; }
.loader-title { font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.loader-msg { font-size: 13.5px; color: var(--muted); font-weight: 600; margin-top: 5px; }

@keyframes hub-spin { to { transform: rotate(360deg); } }
@keyframes hub-pulse { 0%, 100% { opacity: .35; transform: scale(1); } 50% { opacity: 1; transform: scale(1.05); } }
@keyframes hub-ring { 0% { transform: scale(.6); opacity: .7; } 100% { transform: scale(2.1); opacity: 0; } }
@keyframes hub-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
