/* QR Intercom — mobile-first directory + call UI */
:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --panel-2: #273449;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #22c55e;
  --accent-press: #16a34a;
  --danger: #ef4444;
  --danger-press: #dc2626;
  --ring: rgba(34, 197, 94, 0.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.app {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 1.25rem 1rem calc(1.25rem + env(safe-area-inset-bottom));
  flex: 1;
  display: flex;
  flex-direction: column;
}

header.loc { padding: 0.5rem 0 1.25rem; }
header.loc h1 { font-size: 1.5rem; line-height: 1.2; }
header.loc .addr { color: var(--muted); font-size: 0.9rem; margin-top: 0.35rem; }
header.loc .hint { color: var(--muted); font-size: 0.85rem; margin-top: 0.75rem; }

/* status pill under the header */
.status {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-size: 0.8rem; color: var(--muted);
  background: var(--panel); border-radius: 999px;
  padding: 0.3rem 0.7rem; margin-top: 0.75rem; align-self: flex-start;
}
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status.ready .dot { background: var(--accent); }
.status.error .dot { background: var(--danger); }
.status.connecting .dot { background: #eab308; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* directory */
.directory { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 1.25rem; }
.tenant {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; text-align: left;
  background: var(--panel); color: var(--text);
  border: 1px solid transparent; border-radius: 14px;
  padding: 1.05rem 1.15rem; font-size: 1.05rem; font-weight: 600;
  cursor: pointer; transition: transform .06s ease, background .15s ease;
}
.tenant:active { transform: scale(0.985); background: var(--panel-2); }
.tenant:disabled { opacity: 0.5; cursor: default; }
.tenant .call-ico {
  width: 40px; height: 40px; flex: none; border-radius: 50%;
  background: var(--accent); color: #062611;
  display: grid; place-items: center; font-size: 1.15rem;
}

.empty, .fatal {
  margin-top: 2rem; text-align: center; color: var(--muted);
  background: var(--panel); border-radius: 14px; padding: 2rem 1.25rem;
}
.fatal { color: #fecaca; }

/* call overlay */
.overlay {
  position: fixed; inset: 0; background: rgba(8, 12, 22, 0.92);
  backdrop-filter: blur(6px);
  display: none; flex-direction: column; align-items: center; justify-content: center;
  padding: 2rem 1.5rem calc(2rem + env(safe-area-inset-bottom)); z-index: 20;
}
.overlay.show { display: flex; }
.overlay .who { font-size: 1.5rem; font-weight: 700; text-align: center; }
.overlay .call-state {
  margin-top: 0.75rem; color: var(--muted); font-size: 1rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.overlay .avatar {
  width: 108px; height: 108px; border-radius: 50%;
  background: var(--panel-2); display: grid; place-items: center;
  font-size: 2.75rem; margin-bottom: 1.5rem;
  box-shadow: 0 0 0 0 var(--ring);
}
.overlay.ringing .avatar { animation: ring 1.4s infinite; }
@keyframes ring {
  0% { box-shadow: 0 0 0 0 var(--ring); }
  70% { box-shadow: 0 0 0 22px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
.overlay.connected .avatar { background: #14361f; }

.timer { margin-top: 0.5rem; font-variant-numeric: tabular-nums; color: var(--text); font-size: 1.1rem; }
.door-hint { margin-top: 0.9rem; color: var(--muted); font-size: 0.85rem; text-align: center; max-width: 260px; }

.controls { margin-top: 2.5rem; display: flex; gap: 2rem; align-items: center; }
.btn-round {
  width: 72px; height: 72px; border-radius: 50%; border: none; cursor: pointer;
  font-size: 1.6rem; color: #fff; display: grid; place-items: center;
  transition: transform .06s ease;
}
.btn-round:active { transform: scale(0.92); }
.btn-hangup { background: var(--danger); }
.btn-hangup:active { background: var(--danger-press); }
.btn-label { text-align: center; color: var(--muted); font-size: 0.8rem; margin-top: 0.5rem; }

.toast {
  position: fixed; left: 50%; bottom: calc(1.5rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--danger); color: #fff; padding: 0.7rem 1.1rem; border-radius: 12px;
  font-size: 0.9rem; max-width: 90%; text-align: center; z-index: 30;
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.toast.show { opacity: 1; }

footer.brand { text-align: center; color: var(--muted); font-size: 0.75rem; padding-top: 1.5rem; }
