:root {
  --bg: #0a0e17;
  --card: #131a2b;
  --card-border: rgba(255, 255, 255, 0.07);
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.16);
  --green: #22c55e;
  --red: #ef4444;
  --text: #f1f5f9;
  --text-dim: #8b96ab;
  --text-faint: #5b6478;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-pill: 999px;
  --shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

:root[data-theme="light"] {
  --bg: #eef1f6;
  --card: #ffffff;
  --card-border: rgba(15, 23, 42, 0.08);
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --text: #0f172a;
  --text-dim: #5b6478;
  --text-faint: #94a3b8;
  --shadow: 0 12px 28px rgba(15, 23, 42, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
}

.icon {
  width: 20px;
  height: 20px;
  display: inline-block;
  flex-shrink: 0;
}
.icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--card-border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 4px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-logo {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}
.brand-logo .icon {
  width: 22px;
  height: 22px;
}
.brand-text {
  line-height: 1.15;
}
.brand-text .title {
  font-size: 16px;
  font-weight: 600;
}
.brand-text .subtitle {
  font-size: 12px;
  color: var(--text-dim);
}
.topbar-spacer {
  flex: 1;
}
.topbar-datetime {
  font-size: 13px;
  color: var(--text-dim);
  text-align: right;
  margin-right: 6px;
  display: none;
}
.icon-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------- Layout ---------- */
.layout {
  flex: 1;
  display: flex;
  min-height: 0;
}

.sidebar {
  width: 230px;
  flex-shrink: 0;
  border-right: 1px solid var(--card-border);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  border: none;
  background: none;
  text-align: left;
  width: 100%;
}
.sidebar .nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}
.sidebar .nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.sidebar-spacer {
  flex: 1;
}
.profile-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
}
.profile-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.profile-meta {
  line-height: 1.2;
}
.profile-meta .name {
  font-size: 13px;
  font-weight: 600;
}
.profile-meta .role {
  font-size: 11px;
  color: var(--text-dim);
}

.content {
  flex: 1;
  padding: 20px 24px 90px;
  overflow-y: auto;
  min-height: 0;
  position: relative;
}

.pull-indicator {
  position: absolute;
  top: -46px;
  left: 50%;
  width: 34px;
  height: 34px;
  margin-left: -17px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 5;
}
.pull-indicator .icon {
  width: 18px;
  height: 18px;
}
.pull-indicator.spin .icon {
  animation: pull-spin 0.7s linear infinite;
}
@keyframes pull-spin {
  to {
    transform: rotate(360deg);
  }
}

.view {
  display: none;
}
.view.active {
  display: block;
}

.view-title {
  font-size: 20px;
  font-weight: 600;
  margin: 4px 0 16px;
}

/* ---------- Panoramica grid ---------- */
.panoramica-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-areas: "cams clima" "bottom clima";
  gap: 16px;
  align-items: start;
}
#camera-grid-main {
  grid-area: cams;
}
#bottom-row {
  grid-area: bottom;
}
#climate-col-main {
  grid-area: clima;
}
.panoramica-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.camera-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-width: 0;
}
.bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-width: 0;
}
.camera-card,
.climate-card,
.door-card,
.future-card {
  min-width: 0;
}

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Camera card */
.camera-card {
  position: relative;
  aspect-ratio: 4 / 3;
  cursor: pointer;
  background: #05070c;
}
.camera-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.3s;
}
.camera-card img.loaded {
  opacity: 1;
}
.camera-card .live-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  backdrop-filter: blur(4px);
}
.camera-card .live-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  animation: pulse 1.8s infinite;
}
.camera-card .live-badge.offline .dot {
  background: var(--text-faint);
  animation: none;
}
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}
.camera-card .label-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 28px 12px 10px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}
.camera-card .label-bar .icon {
  width: 16px;
  height: 16px;
  opacity: 0.9;
}

/* Climate card */
.climate-card {
  padding: 16px 18px;
}
.climate-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.climate-head-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
}
.climate-head-left .icon {
  color: var(--accent);
}
.power-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  background: transparent;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.power-btn.off {
  border-color: var(--text-faint);
  color: var(--text-faint);
}
.climate-body {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}
.ac-unit {
  width: 45%;
  max-width: 190px;
  position: relative;
  flex-shrink: 0;
}
.ac-unit svg {
  width: 100%;
  display: block;
}
.ac-glow {
  position: absolute;
  bottom: -10px;
  left: 10%;
  right: 10%;
  height: 18px;
  background: radial-gradient(ellipse at center, rgba(59, 130, 246, 0.55), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
  filter: blur(2px);
}
.ac-glow.on {
  opacity: 1;
}
.climate-readout {
  flex: 1;
  text-align: right;
}
.climate-temp {
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
}
.climate-temp .unit {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-dim);
}
.climate-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}
.climate-mode-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.climate-mode-row .icon {
  width: 16px;
  height: 16px;
  color: var(--accent);
}
.climate-status-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-dim);
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}
.status-dot.off {
  background: var(--text-faint);
}
.temp-stepper {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}
.temp-stepper button {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}
.fan-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-pill);
  padding: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.fan-row::-webkit-scrollbar {
  display: none;
}
.fan-row .fan-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
  padding: 0 6px;
  flex-shrink: 0;
  white-space: nowrap;
}
.fan-pill {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}
.fan-pill.active {
  background: var(--accent);
  color: #fff;
}

/* Door card */
.door-card,
.print-card,
.future-card,
.sos-card {
  padding: 16px 18px;
  min-height: 190px;
  display: flex;
  flex-direction: column;
}
.door-card {
  cursor: pointer;
}
.door-card:hover {
  border-color: var(--accent);
}
/* Status on the left, activity on the right: the card was mostly empty air
   either side of the ring while the log stacked below it. */
.door-split {
  display: flex;
  align-items: center;
  gap: 14px;
}
.door-mini-log {
  flex: 1;
  min-width: 0;
  padding-left: 14px;
  border-left: 1px solid var(--card-border);
}
.door-mini-log .mini-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
  padding: 3px 0;
}
.door-mini-log .mini-row .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.door-mini-log .see-all {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  margin-top: 4px;
}

.door-log-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 22px;
  max-width: 420px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}
.door-log-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 14px;
}
.door-log-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--card-border);
  font-size: 13px;
}
.door-log-row .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.door-log-row .dot.open {
  background: var(--red);
}
.door-log-row .dot.closed {
  background: var(--green);
}
.door-log-row .dl-state {
  font-weight: 600;
  flex: 1;
}
.door-log-row .dl-time {
  color: var(--text-dim);
  font-size: 12px;
}
.door-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}
.door-head .icon {
  color: var(--green);
}
.door-body {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 6px;
}
.door-ring {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green);
}
.door-ring.open {
  border-color: var(--red);
  color: var(--red);
}
.door-ring .icon {
  width: 28px;
  height: 28px;
}
.door-status {
  font-size: 15px;
  font-weight: 700;
  color: var(--green);
}
.door-status.open {
  color: var(--red);
}
.door-updated {
  font-size: 11px;
  color: var(--text-faint);
}

.future-card {
  border-style: dashed;
  border-width: 2px;
  border-color: var(--card-border);
  background: transparent;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: none;
  gap: 10px;
}
.future-plus {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px dashed var(--text-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
}
.future-title {
  font-size: 14px;
  font-weight: 600;
}
.future-sub {
  font-size: 12px;
  color: var(--text-dim);
}

/* ---------- Empty state ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--text-dim);
}
.empty-state .icon {
  width: 40px;
  height: 40px;
  color: var(--text-faint);
}
.empty-state .title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

/* ---------- Altro / hub page ---------- */
.hub-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 480px;
}
.hub-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text);
}
.hub-item .icon {
  color: var(--accent);
}
.hub-item .label {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
}
.hub-item .chev {
  color: var(--text-faint);
}
.hub-ha-link {
  margin-top: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

/* Door history */
.history-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-dim);
  padding: 8px 0;
  border-bottom: 1px solid var(--card-border);
}
.history-item .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* ---------- Bottom nav (mobile) ---------- */
.bottomnav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg);
  border-top: 1px solid var(--card-border);
  padding: 8px 4px 10px;
  z-index: 30;
}
.bottomnav-inner {
  display: flex;
  justify-content: space-around;
}
.bottomnav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 11px;
  cursor: pointer;
  padding: 4px 8px;
  flex: 1;
}
.bottomnav .nav-item.active {
  color: var(--accent);
}

/* ---------- Full-screen camera modal ---------- */
.cam-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.cam-modal.open {
  display: flex;
}
.cam-modal img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.cam-modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.cam-modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.cam-modal-nav:hover {
  background: rgba(255, 255, 255, 0.2);
}
.cam-modal-nav.prev {
  left: 16px;
}
.cam-modal-nav.next {
  right: 16px;
}
.cam-modal-nav .icon {
  width: 22px;
  height: 22px;
}
.cam-modal-label {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: var(--radius-pill);
}

/* ---------- Login page ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 28px 26px;
}
.login-label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin: 14px 0 6px;
}
.login-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 11px 13px;
  color: var(--text);
  font-size: 14px;
}
.login-input:focus {
  outline: none;
  border-color: var(--accent);
}
.password-wrap {
  position: relative;
}
.password-wrap .login-input {
  padding-right: 42px;
}
.password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: none;
  background: none;
  color: var(--text-faint);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.password-toggle:hover {
  color: var(--text-dim);
}
.password-toggle svg {
  width: 20px;
  height: 20px;
}
.login-submit {
  width: 100%;
  margin-top: 18px;
  padding: 12px;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.login-submit:disabled {
  opacity: 0.6;
  cursor: default;
}
.login-hint {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
  line-height: 1.4;
}
.brand-stacked {
  flex-direction: column;
  justify-content: center;
  text-align: center;
  gap: 14px;
  margin-bottom: 22px;
}
.brand-logo-big {
  width: 88px;
  height: 88px;
}
.brand-logo-big .icon {
  width: 50px;
  height: 50px;
}
.brand-text-stacked {
  text-align: center;
}
.title-big {
  font-size: 24px;
}
.mfa-hint {
  font-size: 11px;
  color: var(--text-faint);
  margin: -8px 0 6px;
}
.mfa-code-input {
  text-align: center;
  font-size: 22px;
  letter-spacing: 6px;
}
.mfa-secret-fallback {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 14px;
  line-height: 1.5;
}
.mfa-secret-fallback code {
  display: inline-block;
  margin-top: 4px;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  font-size: 12px;
  letter-spacing: 1px;
  word-break: break-all;
}

.install-btn {
  width: 100%;
  margin-top: 22px;
  padding: 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.install-btn:hover {
  background: rgba(255, 255, 255, 0.07);
}
.install-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.4;
}

/* ---------- Profile dropdown ---------- */
.profile-chip {
  position: relative;
  cursor: pointer;
}
.profile-menu {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 10;
}
.profile-menu.open {
  display: block;
}
.profile-menu button {
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.profile-menu button:hover {
  background: rgba(255, 255, 255, 0.05);
}

.notif-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.notif-card .u-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 14px;
}
.notif-card .u-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}
.notif-card .pill-btn {
  margin-left: auto;
}

.passkey-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--card-border);
  font-size: 13px;
}
.passkey-row .p-label {
  flex: 1;
}
.passkey-row .p-meta {
  font-size: 11px;
  color: var(--text-faint);
}

/* ---------- Admin: users & access log ---------- */
.user-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.user-row .u-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.user-row .u-name {
  font-weight: 600;
  font-size: 14px;
}
.user-row .u-meta {
  font-size: 12px;
  color: var(--text-dim);
}
.user-row .u-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.pill-btn {
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pill-btn:hover {
  background: rgba(255, 255, 255, 0.07);
}
.pill-btn.danger {
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.3);
}
.badge-role {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
}
.badge-disabled {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
}
.badge-needs-setup {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-faint);
}

.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.log-table th {
  text-align: left;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 8px 10px;
  border-bottom: 1px solid var(--card-border);
}
.log-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--card-border);
  color: var(--text);
}
.log-event {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.log-event.ok { color: var(--green); }
.log-event.fail { color: var(--red); }
.log-event.info { color: var(--text-dim); }

.confirm-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 20px;
}
.confirm-modal.open {
  display: flex;
}
.confirm-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 22px;
  max-width: 360px;
  width: 100%;
}
.confirm-message {
  font-size: 14px;
  margin-bottom: 18px;
  line-height: 1.4;
}
.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.banner-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 13px;
  display: none;
}
.banner-error.show {
  display: block;
}
.banner-ok {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #86efac;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 13px;
  display: none;
}
.banner-ok.show {
  display: block;
}
.settings-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

/* ---------- Responsive ---------- */
@media (min-width: 900px) {
  .topbar-datetime {
    display: block;
  }
}

@media (max-width: 899px) {
  .sidebar {
    display: none;
  }
  .bottomnav {
    display: block;
  }
  .content {
    padding: 16px 14px 90px;
  }
  .panoramica-grid {
    grid-template-columns: 1fr;
    grid-template-areas: "cams" "clima" "bottom";
  }
  .camera-grid {
    grid-template-columns: 1fr 1fr;
  }
  .bottom-row {
    grid-template-columns: 1fr 1fr;
  }
  .topbar .menu-btn {
    display: none;
  }
  #climate-col-main {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  #climate-col-main .climate-body {
    flex-direction: row;
    align-items: center;
    gap: 14px;
    margin-bottom: 10px;
  }
  /* Spread the readout across the full width instead of leaving the right
     half empty: temp on the left, stepper centred, mode/status right-aligned. */
  #climate-col-main .climate-readout {
    flex: 1;
    min-width: 0;
    display: grid;
    grid-template-columns: auto auto 1fr;
    grid-template-areas:
      "temp stepper mode"
      "sub  stepper status";
    align-items: center;
    column-gap: 16px;
    row-gap: 2px;
    text-align: left;
  }
  #climate-col-main .climate-temp {
    grid-area: temp;
  }
  #climate-col-main .climate-sub {
    grid-area: sub;
    margin-top: 0;
  }
  #climate-col-main .temp-stepper {
    grid-area: stepper;
    margin-top: 0;
    justify-content: center;
  }
  #climate-col-main .climate-mode-row {
    grid-area: mode;
    justify-content: flex-end;
  }
  #climate-col-main .climate-status-row {
    grid-area: status;
    justify-content: flex-end;
  }
  #climate-col-main .ac-unit {
    width: 22%;
    max-width: 90px;
    margin: 0;
    flex-shrink: 0;
  }
}

@media (max-width: 520px) {
  .camera-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .bottom-row {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .climate-body {
    flex-direction: column;
    align-items: stretch;
  }
  .climate-readout {
    text-align: left;
  }
  .climate-mode-row,
  .climate-status-row,
  .temp-stepper {
    justify-content: flex-start;
  }
  .ac-unit {
    width: 60%;
    margin: 0 auto;
  }
}

@media (max-width: 380px) {
  .power-btn {
    width: 44px;
    height: 44px;
  }
  .temp-stepper button {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
  .fan-pill {
    padding: 10px 16px;
    font-size: 13px;
  }
  .fan-row {
    padding: 8px;
    gap: 10px;
  }
  .climate-mode-row {
    padding: 6px 0;
  }
}

/* ---------- Per-person themes ---------- */
/* Step: current blue-dark palette stays the baseline, no override needed. */

:root[data-user-theme="andrea"] {
  --bg: #14161a;
  --card: #1e2126;
  --card-border: rgba(255, 255, 255, 0.08);
  --accent: #6b7684;
  --accent-soft: rgba(107, 118, 132, 0.2);
  --text: #e6e7e9;
  --text-dim: #9aa0a8;
  --text-faint: #676c73;
}

:root[data-user-theme="katia"] {
  --bg: #fdf3f7;
  --card: #ffffff;
  --card-border: rgba(219, 39, 119, 0.12);
  --accent: #ec4899;
  --accent-soft: rgba(236, 72, 153, 0.14);
  --text: #4a3540;
  --text-dim: #8a6b78;
  --text-faint: #c9a8b6;
  --shadow: 0 12px 28px rgba(219, 39, 119, 0.12);
}
:root[data-user-theme="katia"] body {
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 8% 12%, rgba(253, 224, 71, 0.35) 0, transparent 42%),
    radial-gradient(circle at 88% 18%, rgba(147, 197, 253, 0.32) 0, transparent 42%),
    radial-gradient(circle at 50% 92%, rgba(244, 114, 182, 0.2) 0, transparent 45%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cg fill='none' stroke='%23ec4899' stroke-width='2' opacity='0.16'%3E%3Ccircle cx='30' cy='34' r='9'/%3E%3Ccircle cx='20' cy='24' r='7'/%3E%3Ccircle cx='40' cy='24' r='7'/%3E%3Ccircle cx='20' cy='44' r='7'/%3E%3Ccircle cx='40' cy='44' r='7'/%3E%3C/g%3E%3Cg fill='none' stroke='%23fbbf24' stroke-width='2' opacity='0.18'%3E%3Ccircle cx='140' cy='110' r='8'/%3E%3Ccircle cx='131' cy='101' r='6'/%3E%3Ccircle cx='149' cy='101' r='6'/%3E%3Ccircle cx='131' cy='119' r='6'/%3E%3Ccircle cx='149' cy='119' r='6'/%3E%3C/g%3E%3Cg fill='none' stroke='%2360a5fa' stroke-width='2' opacity='0.18'%3E%3Ccircle cx='90' cy='160' r='8'/%3E%3Ccircle cx='81' cy='151' r='6'/%3E%3Ccircle cx='99' cy='151' r='6'/%3E%3Ccircle cx='81' cy='169' r='6'/%3E%3Ccircle cx='99' cy='169' r='6'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat, no-repeat, repeat;
  background-attachment: fixed, fixed, fixed, fixed;
}

/* ---------- Print card ---------- */
.print-drop {
  flex: 1;
  margin-top: 10px;
  border: 1.5px dashed var(--card-border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 18px 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  min-height: 120px;
}
.print-drop:hover,
.print-drop.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.print-drop.busy {
  opacity: 0.6;
  pointer-events: none;
}
.print-card .door-head .icon {
  color: var(--accent);
}
.printer-unit {
  width: 58%;
  max-width: 150px;
  margin: 0 auto 2px;
}
.printer-unit svg {
  width: 100%;
  display: block;
}
.print-drop-title {
  font-size: 14px;
  font-weight: 600;
}
.print-drop-sub {
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.4;
}
.print-status {
  font-size: 12px;
  margin-top: 10px;
  min-height: 16px;
  color: var(--text-dim);
  word-break: break-word;
}
.print-status.ok { color: var(--green); }
.print-status.err { color: var(--red); }
.print-status.busy { color: var(--text-dim); }

/* ---------- PTZ arrows (kitchen camera only) ---------- */
.ptz-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  /* Deliberately faint: the picture matters more than the controls. */
  opacity: 0.45;
  transition: opacity 0.15s, background 0.15s;
  backdrop-filter: blur(3px);
  z-index: 3;
}
.ptz-btn svg {
  width: 17px;
  height: 17px;
}
.ptz-btn.left { left: 8px; }
.ptz-btn.right { right: 8px; }
.camera-card:hover .ptz-btn { opacity: 0.85; }
.ptz-btn:hover { background: rgba(0, 0, 0, 0.65); opacity: 1; }
.ptz-btn:disabled { opacity: 0.25; cursor: default; }

/* Touch screens have no hover, so keep them readable but still discreet. */
@media (hover: none) {
  .camera-card .ptz-btn { opacity: 0.6; }
}

/* Pan bar in the full-screen view: bottom centre, clear of the edge arrows
   that switch camera. */
.ptz-bar {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  z-index: 6;
}
.ptz-bar-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
}
.ptz-bar-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s;
}
.ptz-bar-btn svg { width: 20px; height: 20px; }
.ptz-bar-btn:hover { background: rgba(255, 255, 255, 0.28); }
.ptz-bar-btn:disabled { opacity: 0.4; cursor: default; }

.mini-row.quiet {
  color: var(--text-faint);
  font-style: italic;
}

/* Narrow phones: keep the two columns, just shrink the dial. */
@media (max-width: 420px) {
  .door-split {
    gap: 10px;
  }
  .door-ring {
    width: 58px;
    height: 58px;
  }
  .door-ring .icon {
    width: 22px;
    height: 22px;
  }
  .door-status {
    font-size: 13px;
  }
  .door-mini-log {
    padding-left: 10px;
  }
  .door-mini-log .mini-row {
    font-size: 10.5px;
  }
}

/* ---------- Camera master switch ---------- */
.cam-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.cam-bar.hidden {
  display: none;
}
.cam-off-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  font-size: 11.5px;
  font-weight: 600;
}
.cam-off-pill.hidden {
  display: none;
}
.cam-off-pill .icon {
  width: 14px;
  height: 14px;
}
.cam-power-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.cam-power-btn:hover {
  border-color: rgba(239, 68, 68, 0.5);
  color: #fca5a5;
}
.cam-power-btn .icon {
  width: 15px;
  height: 15px;
}
.cam-power-btn.is-off {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.cam-power-btn.is-off:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Veil sits above the tile, so it also swallows taps: a switched-off camera
   can't be opened full-screen or panned. */
.cam-veil {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #05070c;
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 600;
  z-index: 4;
}
.cameras-off .cam-veil {
  display: flex;
}
.cam-veil .icon {
  width: 26px;
  height: 26px;
}
.cameras-off .live-badge {
  display: none;
}

/* Top-bar camera cut-off */
.hidden {
  display: none;
}
.icon-btn.cam-cut {
  background: rgba(239, 68, 68, 0.16);
  color: var(--red);
}
.icon-btn.cam-cut:hover {
  background: rgba(239, 68, 68, 0.24);
  color: var(--red);
}

/* ---------- Print-only account ----------
   Deliberately oversized: one reader, on a phone, who should never have to hunt
   for the next step. */
body.print-only .sidebar,
body.print-only .menu-btn,
body.print-only .topbar-datetime,
body.print-only #camera-grid-main,
body.print-only #climate-col-main,
body.print-only .view-title,
body.print-only .topbar .icon-btn {
  display: none;
}
body.print-only .panoramica-grid {
  display: block;
}
body.print-only .content {
  padding: 18px 16px 40px;
  display: flex;
  justify-content: center;
}
body.print-only #bottom-row {
  display: block;
  width: 100%;
  max-width: 460px;
}

.print-solo {
  padding: 22px 20px 24px;
  text-align: center;
}
.print-solo-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 18px;
}
.print-solo-head .icon {
  width: 24px;
  height: 24px;
  color: var(--accent);
}
.print-solo-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.print-solo-stage.hidden {
  display: none;
}
.print-solo .printer-unit {
  width: 120px;
  margin: 4px auto 2px;
}
.print-solo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 58px;
  padding: 0 20px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}
.print-solo-btn .icon {
  width: 22px;
  height: 22px;
}
.print-solo-btn.primary {
  background: var(--accent);
  color: #fff;
}
.print-solo-btn.primary:disabled {
  opacity: 0.6;
}
.print-solo-btn.ghost {
  background: none;
  border-color: var(--card-border);
  color: var(--text-dim);
  min-height: 46px;
  font-size: 15px;
  font-weight: 600;
}
.print-solo-hint {
  font-size: 13.5px;
  color: var(--text-dim);
}
.print-solo-preview {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border-radius: var(--radius-md);
  background: #05070c;
}
.print-solo-name {
  font-size: 13.5px;
  color: var(--text-dim);
  word-break: break-all;
}
.print-solo-status {
  margin-top: 16px;
  font-size: 15px;
  font-weight: 600;
  min-height: 22px;
}
.print-solo-status.ok {
  color: var(--green);
}
.print-solo-status.err {
  color: var(--red);
}
.print-solo-status.busy {
  color: var(--text-dim);
}

/* ---------- Admin: role picker + set password ---------- */
.role-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
}
.role-pick .icon {
  width: 14px;
  height: 14px;
}
.role-pick select {
  background: none;
  border: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  outline: none;
}
.role-pick select option {
  background: var(--card);
  color: var(--text);
}

.u-setpw {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--card-border);
}
.u-setpw.hidden {
  display: none;
}
.u-setpw input {
  flex: 1;
  min-width: 200px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.u-setpw-msg {
  flex-basis: 100%;
  font-size: 12px;
}
.u-setpw-msg.ok {
  color: var(--green);
}
.u-setpw-msg.err {
  color: var(--red);
}

/* ---------- Recordings ---------- */
.rec-wrap {
  max-width: 900px;
}
.rec-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.rec-pick {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 600;
}
.rec-pick select {
  background: none;
  border: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  outline: none;
}
.rec-pick select option {
  background: var(--card);
  color: var(--text);
}
.rec-meta {
  font-size: 12.5px;
  color: var(--text-dim);
}

.rec-stage {
  position: relative;
  background: #05070c;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
}
#rec-player {
  width: 100%;
  height: 100%;
  display: none;
  background: #05070c;
}
#rec-player.show {
  display: block;
}
.rec-empty {
  color: var(--text-faint);
  font-size: 13px;
  padding: 0 20px;
  text-align: center;
}
.rec-now {
  margin: 10px 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  min-height: 18px;
}

/* 24-hour strip. Blocks are absolutely positioned by clock time, so a gap in
   the strip is a gap in the footage — the fastest way to spot a camera that
   stopped during the night. */
.rec-axis {
  position: relative;
  height: 14px;
  margin-top: 8px;
}
.rec-axis span {
  position: absolute;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--text-faint);
}
.rec-timeline {
  position: relative;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  overflow: hidden;
}
.rec-block {
  position: absolute;
  top: 5px;
  bottom: 5px;
  padding: 0;
  border: none;
  border-radius: 3px;
  background: var(--accent);
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 0.12s, transform 0.12s;
}
.rec-block:hover {
  opacity: 0.9;
}
.rec-block.playing {
  opacity: 1;
  background: var(--green);
  box-shadow: 0 0 0 1px var(--green);
}
.rec-loading {
  padding: 13px;
  font-size: 12.5px;
  color: var(--text-dim);
}
.rec-hint {
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--text-faint);
}

/* Motion overlay: a separate layer above the segment blocks, so a burst that
   straddles two segments draws as one band instead of being cut at the seam. */
.rec-motion-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.rec-motion-layer i {
  position: absolute;
  top: 5px;
  height: 9px;
  border-radius: 2px;
  background: #facc15;
  box-shadow: 0 0 4px rgba(250, 204, 21, 0.5);
}
.rec-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 9px;
  font-size: 11.5px;
  color: var(--text-dim);
}
.rec-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.rec-legend .sw {
  width: 14px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
}
.rec-legend .sw.blue {
  background: var(--accent);
  opacity: 0.55;
}
.rec-legend .sw.yellow {
  background: #facc15;
}
.rec-legend-note {
  color: var(--text-faint);
}

/* ---------- SOS panic buttons ---------- */
.sos-card .door-head .icon { color: var(--red); }
.sos-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.sos-item {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
}
.sos-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sos-dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(34,197,94,0.15); }
.sos-dot.off { background: var(--text-faint); }
.sos-name { flex: 1; font-weight: 600; }
.sos-batt {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  color: var(--text-dim);
}
.sos-batt .icon { width: 13px; height: 13px; }
.sos-batt.low { color: var(--red); }
.sos-log {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--card-border);
}
.sos-log-title { font-size: 11px; color: var(--text-faint); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.04em; }
.sos-log-empty { font-size: 12px; color: var(--text-faint); }
.sos-log-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-dim);
  padding: 2px 0;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sos-log-row .sos-log-text {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.sos-log-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red); flex-shrink: 0; }
