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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue",
    Arial, sans-serif;
  background: #000;
  color: #fff;
}

/* APP SHELL */
.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 16px 14px 32px;
}

/* LOGO */
#mainLogo {
  display: block;
  width: 60%;
  max-width: 220px;
  margin: 8px auto 16px auto;
  transition: all 0.3s ease;
}

#mainLogo.smallMode {
  width: 42%;
  max-width: 170px;
  margin-top: 0;
  margin-bottom: 10px;
}

/* CARDS */
.card {
  background: #101117;
  border-radius: 20px;
  padding: 14px 16px 16px;
  margin-bottom: 14px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.55);
}

/* INSTALL CARD */
.install-card h2 {
  font-size: 20px;
  margin: 0 0 6px 0;
  text-align: center;
}

.install-required {
  font-size: 14px;
  text-align: center;
  margin-bottom: 10px;
}

.highlight {
  font-weight: 600;
}

.platform-steps h3 {
  font-size: 16px;
  margin: 8px 0 4px;
}

.platform-steps ol {
  margin: 0 0 8px 20px;
  padding: 0;
  font-size: 14px;
}

.install-note {
  font-size: 13px;
  opacity: 0.8;
  text-align: center;
}

/* LOGIN CARD */
.login-card {
  margin-top: 8px;
}

.login-title {
  font-size: 22px;
  text-align: center;
  margin: 0 0 4px;
}

.login-subtitle {
  font-size: 14px;
  text-align: center;
  margin: 0 0 10px;
  opacity: 0.85;
}

.login-card input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #fff;
  background: #05060a;
  color: #fff;
  font-size: 15px;
  margin-bottom: 10px;
}

.login-card input::placeholder {
  color: #666b7a;
}

.loading {
  font-size: 13px;
  text-align: center;
  margin-top: 6px;
}

/* BUILDING SELECTOR */
.building-selector label {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}

.building-selector select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #fff;
  background: #05060a;
  color: #fff;
  font-size: 15px;
}

/* BUILDING CARD */
.building-card {
  padding-top: 10px;
}

.building-header {
  text-align: center;
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 10px;
}

/* LOCK BLOCKS */
.lock-block {
  background: #181a23;
  border-radius: 16px;
  padding: 10px 12px 12px;
  margin-bottom: 10px;
}

.lock-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.lockTitle {
  font-size: 18px;
  font-weight: 500;
}

.batteryTag {
  font-size: 14px;
}

.lock-btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ENTRANCE LABEL */
.entrance-label {
  font-size: 16px;
  font-weight: 600;
  margin: 10px 4px 6px;
}

/* BUILDING INFO */
.building-info {
  background: #000000;
  border-radius: 14px;
  padding: 10px 12px 12px;
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.4;
}

.building-info b {
  font-weight: 600;
}

.info-notes {
  margin-top: 6px;
  font-size: 13px;
}

.copyIcon {
  margin-left: 6px;
  cursor: pointer;
}

/* COPY BUTTON */
.copy-btn {
  background: #1a2332;
  border: 1px solid #3b82f6;
  color: #3b82f6;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.copy-btn:active {
  transform: scale(0.95);
  background: #3b82f6;
  color: white;
}

/* BUTTONS */
.btn {
  border: 2px solid #fff;
  border-radius: 14px;
  padding: 12px 10px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease, opacity 0.15s ease;
}

.btn.full {
  width: 100%;
  margin-top: 8px;
}

.btn.primary {
  background: #073583;
  color: #ffffff;
  border: 1px solid #fff;
}

.btn.secondary {
  background: #073583;
  color: #ffffff;
  border: 1px solid #fff;
}

.btn:active {
  transform: translateY(1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.lock-btn {
  background: #073583;
  color: #fff;
  border-radius: 18px;
  border: 2px solid #fff;
  padding: 14px 0;
  font-size: 17px;
  font-weight: 600;
  height: 52px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.2s ease;
}

.lock-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.lock-btn.busy {
  opacity: 0.6;
}

/* NO LOCKS */
.noLocks {
  text-align: center;
  padding: 20px 10px;
  font-size: 15px;
}

/* TOAST */
.toast-container {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 999;
  max-width: 480px;
  width: 100%;
  pointer-events: none;
  padding: 0 14px;
}

.toast {
  background: #2b3340;
  color: #fff;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  text-align: center;
  margin-top: 6px;
  pointer-events: auto;
  white-space: pre-line;
}

.toast-error {
  background: #b91c1c;
}

.toast.fade-out {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* UTIL */
.hidden {
  display: none !important;
}

/* CUSTOMER SERVICE POPUP */
.cs-popup {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.cs-popup-inner {
  background: #11131a;
  padding: 20px;
  border-radius: 18px;
  width: 90%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.cs-popup-inner h3 {
  color: #fff;
  font-size: 20px;
  margin: 0 0 16px 0;
}

/* LOGOUT BUTTON */
.logout-container {
  text-align: center;
  margin-top: 24px;
  padding-bottom: 20px;
}

.logout-btn {
  background: transparent;
  color: #888;
  border: 1px solid #333;
  padding: 10px 24px;
  font-size: 14px;
  border-radius: 8px;
}

.logout-btn:active {
  background: #222;
}

/* EMERGENCY CODE MODAL */
.emergency-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.emergency-modal-content {
  background: #1a1a1a;
  border-radius: 16px;
  padding: 24px;
  max-width: 360px;
  width: 100%;
  text-align: center;
}

.emergency-modal-content h3 {
  margin: 0 0 12px 0;
  font-size: 1.3rem;
  color: #ff6b6b;
}

.emergency-modal-content p {
  margin: 0 0 12px 0;
  font-size: 0.95rem;
  color: #ccc;
  line-height: 1.4;
}

.emergency-subtitle {
  font-size: 0.85rem !important;
  color: #888 !important;
}

.emergency-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.emergency-btn {
  padding: 14px 20px;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
}

.emergency-btn.primary {
  background: #3b82f6;
  color: #fff;
}

.emergency-btn.primary:disabled {
  opacity: 0.6;
}

.emergency-btn.secondary {
  background: transparent;
  color: #888;
  border: 1px solid #333;
}

.emergency-code-display {
  margin-top: 20px;
  padding: 20px;
  background: #0a0a0a;
  border-radius: 12px;
}

.emergency-code-value {
  font-family: monospace;
  font-size: 2.5rem;
  font-weight: bold;
  color: #4ade80;
  letter-spacing: 4px;
  margin-bottom: 16px;
}

.emergency-instructions {
  font-size: 0.9rem !important;
  color: #aaa !important;
}

.emergency-warning {
  font-size: 0.8rem !important;
  color: #f59e0b !important;
  margin-top: 12px !important;
}