:root {
  --bg: #0a0a0b;
  --tile: #141416;
  --tile2: #1c1c1f;
  --border: #2a2a2e;
  --text: #f4f4f5;
  --muted: #8b8b90;
  --mint: #5eead4;
  --amber: #fbbf24;
  --heat: #fb923c;
  --font: "DM Sans", system-ui, sans-serif;
  --font-head: "Sora", var(--font);
  --r: 20px;
  --gap: 14px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}

body {
  background-image:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(94, 234, 212, 0.07), transparent 50%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(251, 191, 36, 0.05), transparent 45%);
}

#app {
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(12px, 2.5vw, 20px);
  height: 100%;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* —— Meta bar (Wi‑Fi, dată) —— */
.bento-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: var(--gap);
  min-height: 36px;
  flex-shrink: 0;
}

/* —— Bento principal: ocupă restul înălțimii, fără scroll pe pagină —— */
.bento {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

/* —— Rând sus: siglă + Vreme (aceeași înălțime) —— */
.bento-top-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  align-items: stretch;
  flex: 0.95 1 0;
  min-height: 0;
  overflow: hidden;
}

.brand-tile-inner {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex: 1;
  min-height: 0;
  width: 100%;
}
.brand-logo-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
}
.brand-logo {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

@media (max-width: 720px) {
  .bento-top-row {
    grid-template-columns: 1fr;
  }
}

/* —— Rând principal: Căldură | Camere | Muzică | Lumină —— */
.bento-main-row {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--gap);
  align-items: stretch;
  flex: 1.05 1 0;
  min-height: 0;
  overflow: hidden;
}
.tile-heat {
  flex: 1.35 1 260px;
  min-width: min(100%, 260px);
  min-height: 0;
  overflow: hidden;
}
.tile-cameras {
  flex: 0 0 clamp(116px, 16vw, 200px);
  width: clamp(116px, 16vw, 200px);
  max-width: min(100%, 200px);
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.tile-cameras h2 {
  flex-shrink: 0;
}
.tile-music {
  flex: 1 1 200px;
  min-width: min(100%, 180px);
  min-height: 0;
  overflow: hidden;
}
.tile-light {
  flex: 1 1 220px;
  min-width: min(100%, 180px);
  min-height: 0;
  overflow: hidden;
}

.room-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding-right: 4px;
  margin: 6px -2px 0 0;
  -webkit-overflow-scrolling: touch;
}
.room-nav-btn {
  flex-shrink: 0;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--tile2) 0%, #151518 100%);
  color: var(--text);
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s,
    color 0.15s;
}
.room-nav-btn:hover {
  border-color: rgba(94, 234, 212, 0.35);
  color: var(--mint);
}
.room-nav-btn.is-active {
  border-color: rgba(94, 234, 212, 0.55);
  background: linear-gradient(180deg, #1a2e2c 0%, #141416 100%);
  color: #a7f3d0;
  box-shadow: inset 0 0 0 1px rgba(94, 234, 212, 0.12);
}
.room-nav-btn:focus-visible {
  outline: 2px solid rgba(94, 234, 212, 0.45);
  outline-offset: 2px;
}

@media (max-width: 1100px) {
  .bento-main-row {
    flex-direction: column;
    flex-wrap: nowrap;
    overflow: hidden;
  }
  .tile-heat,
  .tile-music,
  .tile-light {
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
    min-height: 0;
  }
  .tile-cameras {
    flex: 1 1 0;
    width: 100%;
    max-width: none;
    min-height: 140px;
  }
}

@media (max-width: 720px) and (orientation: landscape) {
  .bento-top-row {
    grid-template-columns: 1fr 1fr;
  }
}

.brand-hit {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(145deg, #222226, #0e0e10);
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  position: relative;
}
.brand-hit::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 8px;
  background: conic-gradient(from 210deg, var(--mint), var(--amber), #f472b6, var(--mint));
  opacity: 0.55;
}

.top-dateline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  min-width: 0;
}
.top-wifi-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.top-wifi-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}
.top-wifi-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}
.top-wifi-icon--on {
  color: #5eead4;
}
.top-wifi-icon--off {
  color: #71717a;
}
.top-wifi-name {
  font-family: var(--font);
  font-weight: 600;
  font-size: clamp(0.75rem, 2.2vw, 0.88rem);
  max-width: min(160px, 32vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.top-wifi-name.is-online {
  color: #a7f3d0;
}
.top-wifi-name.is-offline {
  color: #a1a1aa;
}
.top-datetime {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  line-height: 1.35;
  color: #e4e4e7;
  min-width: 0;
}

.tile {
  background: var(--tile);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 18px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}

.tile.tile-brand {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 14px 16px;
  background: #000000;
  border-color: #1c1c1f;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.tile h2,
.tile .heat-title {
  font-family: var(--font-head);
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: 0.02em;
}

.tile-sub {
  margin: 0 0 12px;
  font-size: 0.75rem;
  color: var(--muted);
}

.tile-weather {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(94, 234, 212, 0.12), transparent 55%),
    linear-gradient(165deg, #16161d 0%, #0e0e10 100%);
  border-color: rgba(94, 234, 212, 0.12);
}
.w-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 6px;
  flex-shrink: 0;
}
.w-head h2 {
  margin: 0;
}
.w-loc {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
}
.w-hero {
  margin-top: 2px;
  flex-shrink: 0;
}
.w-forecast {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.w-hero-text .tile-sub {
  margin-bottom: 6px;
}
.w-big-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}
.w-big {
  font-family: var(--font-head);
  font-size: clamp(2.2rem, 6vw, 3rem);
  font-weight: 700;
  color: var(--mint);
  margin: 0;
  text-shadow: 0 0 40px rgba(94, 234, 212, 0.25);
}
.w-hero-ic {
  font-size: clamp(2rem, 5vw, 2.75rem);
  line-height: 1;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
}
.w-fc-title {
  margin: 14px 0 10px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.w-day-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.w-day {
  position: relative;
  overflow: hidden;
  padding: 10px 8px 12px;
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(30, 30, 34, 0.95) 0%, rgba(18, 18, 22, 0.98) 100%);
  border: 1px solid rgba(42, 42, 46, 0.9);
  text-align: center;
}
.w-day::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(80% 60% at 50% -20%, rgba(94, 234, 212, 0.08), transparent 70%);
  pointer-events: none;
}
.w-day-ic {
  font-size: 1.45rem;
  line-height: 1.2;
  margin-bottom: 4px;
}
.w-day-name {
  font-size: 0.68rem;
  font-weight: 600;
  color: #c4c4c9;
  margin-bottom: 6px;
}
.w-day-temp {
  font-size: 0.78rem;
  margin-bottom: 4px;
}
.w-day-hi {
  font-weight: 700;
  color: var(--text);
}
.w-day-lo {
  color: var(--muted);
  font-weight: 500;
}
.w-day-rain {
  font-size: 0.65rem;
  color: #7dd3fc;
  font-weight: 500;
}
@media (max-width: 720px) {
  .w-day-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.tile-heat {
  display: flex;
  flex-direction: column;
}
.heat-title {
  margin: 0 0 8px;
}
.heat-thermo {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-height: 0;
}

.tile-music {
  background: linear-gradient(180deg, var(--tile) 0%, #18181c 100%);
}

.tile-light {
  align-self: stretch;
}

/* Căldură — același limbaj vizual ca tile-urile Bento */
.heat-panel {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 4px 0 0;
}
.heat-dial-wrap {
  width: min(176px, 48vw);
  margin: 4px auto 2px;
  touch-action: none;
  user-select: none;
}
.heat-dial-wrap .dial-svg {
  width: 100%;
  display: block;
  cursor: grab;
}
.heat-dial-wrap .dial-svg:active {
  cursor: grabbing;
}
.heat-set-display {
  font-family: var(--font-head);
  font-size: clamp(2rem, 6vw, 2.65rem);
  font-weight: 700;
  color: var(--mint);
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-align: center;
  text-shadow: 0 0 36px rgba(94, 234, 212, 0.22);
}
.heat-unit-display {
  font-size: 0.5em;
  font-weight: 600;
  color: var(--muted);
  margin-left: 2px;
  vertical-align: super;
}
.heat-room-small {
  margin: 10px auto 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--muted);
  max-width: 22em;
  text-align: center;
}
.heat-room-lbl {
  display: block;
  margin-bottom: 2px;
}
.heat-room-num {
  color: #e4e4e7;
  font-weight: 600;
}
.heat-call {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 8px auto 0;
  width: 100%;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  color: var(--mint);
}
.heat-call.hidden {
  display: none;
}
.heat-flame-svg {
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(251, 146, 60, 0.45));
}
.heat-controls {
  display: flex;
  align-items: stretch;
  gap: 12px;
  margin-top: 18px;
  width: 100%;
}
.heat-ctrl-btn {
  flex: 0 0 48px;
  height: 48px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--tile2) 0%, #151518 100%);
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 500;
  cursor: pointer;
  transition:
    border-color 0.15s,
    color 0.15s,
    background 0.15s;
}
.heat-ctrl-btn:hover {
  border-color: rgba(94, 234, 212, 0.35);
  color: var(--mint);
}
.heat-ctrl-btn:active {
  transform: scale(0.97);
}
.heat-slider-block {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.heat-slider-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}
.heat-range-min,
.heat-range-max {
  font-weight: 600;
  color: #71717a;
}
.heat-slider {
  width: 100%;
  height: 10px;
  margin: 0;
  accent-color: var(--mint);
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}
.heat-slider:focus {
  outline: none;
}
.heat-slider:focus-visible {
  outline: 2px solid rgba(94, 234, 212, 0.45);
  outline-offset: 4px;
  border-radius: 6px;
}
.heat-slider::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #1e1e22 0%, #2a2a30 100%);
  border: 1px solid var(--border);
}
.heat-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -7px;
  border-radius: 50%;
  background: linear-gradient(145deg, #f4f4f5, #d4d4d8);
  border: 2px solid #5eead4;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  cursor: grab;
}
.heat-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
}
.heat-slider::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #1e1e22 0%, #2a2a30 100%);
  border: 1px solid var(--border);
}
.heat-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(145deg, #f4f4f5, #d4d4d8);
  border: 2px solid #5eead4;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  cursor: grab;
}

/* Muzică — dispozitiv cameră */
.bt-main {
  margin-top: 6px;
}
.bt-device-name {
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #1a1a1e 0%, #141416 100%);
  text-align: center;
}
.bt-hint {
  margin: 10px 0 0;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--muted);
  text-align: center;
}
.bt-hint.hidden {
  display: none;
}

.btn-sm {
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.78rem;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--tile2);
  color: var(--text);
  cursor: pointer;
  width: 100%;
}
.btn-sm:hover {
  border-color: #52525b;
}
.btn-sm.danger {
  border-color: #7f1d1d;
  color: #fecaca;
}

/* Color wheel */
.wheel-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 2px;
}
#color-wheel {
  border-radius: 50%;
  cursor: crosshair;
  touch-action: none;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
.wheel-preview {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 2px solid var(--border);
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.3);
}

/* Overlays */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  overflow-y: auto;
}
.overlay.hidden {
  display: none;
}
.overlay-card {
  width: min(380px, 100%);
  background: var(--tile);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 22px;
}
.overlay-wide {
  width: min(720px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  background: var(--tile);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px 22px 28px;
}
.overlay-card h2,
.overlay-wide h2 {
  font-family: var(--font-head);
  margin: 0 0 6px;
}
.muted {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 16px;
}
.svc-access-hint {
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--muted);
  margin: -6px 0 16px;
}
.svc-access-hint strong {
  color: var(--text);
  font-weight: 600;
}
.overlay-card label,
.svc-section label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 12px;
}
.overlay-card input,
.svc-section input[type="text"],
.svc-section input[type="password"],
.svc-section select {
  width: 100%;
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0c0c0e;
  color: var(--text);
  font-family: var(--font);
}
.err {
  color: #f87171;
  font-size: 0.85rem;
  margin: 0 0 8px;
}
.err.hidden {
  display: none;
}
.row-btns {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}
.btn-prim {
  flex: 1;
  padding: 10px 14px;
  border: none;
  border-radius: 12px;
  font-family: var(--font);
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, var(--mint), #2dd4bf);
  color: #042f2e;
}
.btn-ghost {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
}

.svc-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.svc-section {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.svc-section:last-child {
  border-bottom: none;
}
.svc-section h3 {
  font-family: var(--font-head);
  font-size: 0.95rem;
  margin: 0 0 10px;
}
.svc-wifi-intro {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.45;
}
.ra-warn {
  font-size: 0.7rem;
  color: #fdba74;
  font-weight: 500;
}
.ra-wifi-help {
  margin: 0 0 10px;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--muted);
}
.ra-wifi-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.ra-wifi-qr {
  display: block;
  margin: 10px 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
}
.hint-inline {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.75rem;
}
.ra-vis-label {
  display: block;
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--text);
}
.ra-vis-label input {
  margin-right: 8px;
}

.room-admin-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}
.room-admin-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px 12px;
  padding: 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--tile2);
  align-items: start;
}
.drag-handle {
  cursor: grab;
  font-size: 1.2rem;
  color: var(--muted);
  user-select: none;
  line-height: 1.2;
  padding-top: 4px;
}
.room-admin-fields {
  display: grid;
  gap: 8px;
}
.room-admin-fields input[type="text"] {
  margin-top: 0;
}
.chk-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  font-size: 0.8rem;
  color: var(--text);
}
.chk-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  cursor: pointer;
}
.svc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.svc-actions button {
  font-size: 0.75rem;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0c0c0e;
  color: var(--text);
  cursor: pointer;
}
.tpl-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  align-items: center;
}
.tpl-row input,
.tpl-row select {
  flex: 1;
  min-width: 140px;
  margin-top: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.hidden {
  display: none !important;
}

.tile.hidden {
  display: none !important;
}
