/* ======================= BASE ======================= */
body, html {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #e0e0e0;
  font-family: 'Segoe UI', Arial, sans-serif;
}

#logo-container {
  position: absolute;
  top: 0;
  width: 100vw;
  height: 102px;
  background: rgba(255,255,255,0.98);
  z-index: 1200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: calc(env(safe-area-inset-top, 0px) + 10px);
}

#logo-container img {
  max-height: 88px;
  margin: 0 auto;
  display: block;
  pointer-events: none;
  width: auto;
}

#status {
  position: absolute;
  top: 106px;
  width: 100vw;
  text-align: center;
  padding: 4px 2px;
  background: #e8eaf6;
  font-weight: 500;
  font-size: 17px;
  z-index: 1201;
  border-bottom: 1px solid #d0d3e3;
  border-radius: 0 0 10px 10px;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  line-height: 1.25;
  min-height: calc(1em * 1.25);
}

#modeBanner {
  position: absolute;
  top: 145px;
  width: 100vw;
  box-sizing: border-box;
  text-align: center;
  padding: 7px 8px;
  background: #90caf9;
  color: #0d3b66;
  font-weight: 700;
  font-size: 18px;
  z-index: 1202;
  border-bottom: 1px solid #5aa6de;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
}

.mode-open { background: #90caf9 !important; color: #0d3b66 !important; border-bottom-color: #5aa6de !important; }
.mode-close { background: #ef9a9a !important; color: #6b1b1b !important; border-bottom-color: #d46a6a !important; }
.mode-checker { background: #ffe082 !important; color: #4b3b00 !important; border-bottom-color: #d5b84c !important; }

.fab {
  position: absolute;
  z-index: 1000;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.19);
  font-size: 30px;
  border: none;
  outline: none;
  transition: background 0.2s, opacity 0.2s, transform 0.08s;
  cursor: pointer;
  color: #fff;
  opacity: 0.92;
}

.fabs-left  .fab { left:  calc(15px + env(safe-area-inset-left, 0px));  }
.fabs-right .fab { right: calc(15px + env(safe-area-inset-right, 0px)); }

#fabConfig   { top: 236px; background: #7a7a7a; }
#fabDetails  { top: 306px; background: #226aff; }
#fabAccess   { top: 306px; background: #226aff; }
#fabListar   { top: 376px; background: #10b981; }
#fabQRCode   { top: 446px; background: #f59e0b; }
#fabSync     { top: 516px; background: #8f8f8f; }

.fab:active { transform: translateY(1px); }
.fab[hidden] { display: none !important; }
.fab-disabled, .fab:disabled {
  opacity: 0.45 !important;
  cursor: default !important;
  pointer-events: none !important;
}

.modal, .modal-backdrop {
  position: fixed; top:0; left:0; width:100vw; height:100vh;
  display: flex; align-items: flex-start; justify-content: center;
  z-index: 2000;
}
.modal-backdrop { background: rgba(0,0,0,0.35); z-index: 2001; }
.modal { z-index: 2002; pointer-events: all; }

.modal-content,
form.modal-content {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.13);
  min-width: 320px;
  width: 98vw;
  max-width: 800px;
  padding: 0;
  text-align: left;
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.modal-header {
  position: sticky;
  top: 0;
  background: #fff;
  padding: 12px 14px;
  border-bottom: 1px solid #ddd;
  z-index: 11;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  text-align: left;
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: #999;
  cursor: pointer;
}

.wide-modal {
  max-width: 800px;
  width: 95vw;
}

.scrollable-modal {
  display: flex;
  flex-direction: column;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 18px 16px 18px;
}

.modal-footer {
  background: #fff;
  padding: 10px 14px;
  text-align: right;
  border-top: 1px solid #ddd;
  box-shadow: 0 -2px 5px rgba(0,0,0,0.05);
  z-index: 10;
}

.form-group {
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
}

.form-group label {
  margin-bottom: 3px;
  font-weight: 500;
  font-size: 14px;
}

.form-group input, .form-group select, .form-group textarea {
  padding: 2px 4px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.form-group input { height: 26px; }
.form-group textarea { min-height: 64px; resize: vertical; }
.form-group select { height: 26px; }
.form-group select option {
  font-size: 14px;
  padding: 6px 8px;
  line-height: 1.6;
}

.form-group.inline {
  flex-direction: row;
  align-items: center;
}
.form-group.inline label {
  margin: 0 8px 0 0;
  width: auto;
}
.form-group.inline select {
  flex: 1;
}

.btn-save {
  margin-top: 5px;
  padding: 8px 14px;
  background: #226aff;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
}
.btn-save:hover {
  background: #1a55cc;
}

#footer-app {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100vw;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-size: 12px;
  line-height: 1.2;
  padding: 6px 10px;
  padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  background: #d6d6d6;
  border-top: 1px solid #bcbcbc;
  color: #333;
  z-index: 1500;
  white-space: normal;
  overflow-wrap: anywhere;
}

.builder-root .section { margin-bottom: 18px; }
.builder-root .repeat-block {
  background: #f7f7f7;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
}
.form-group .invalid, .form-group input.invalid, .form-group select.invalid, .form-group textarea.invalid {
  border-color: #e53935 !important;
  box-shadow: 0 0 0 2px rgba(229,57,53,0.15);
}

#main {
  padding: 214px 16px 110px;
  max-width: 980px;
  margin: 0 auto;
  box-sizing: border-box;
}

body.fabs-right #main { padding-right: calc(16px + 72px); }
body.fabs-left  #main { padding-left:  calc(16px + 72px); }
.card {
  background: rgba(255,255,255,.95);
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 8px 22px rgba(0,0,0,.06);
}

.row {
  display: flex;
  align-items: center;
}

.btn-secondary {
  background: rgba(0,0,0,.06);
  border: 1px solid rgba(0,0,0,.12);
  color: #111;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 16px;
}

.btn-secondary:active { transform: scale(.99); }
.radio-row{display:flex;gap:8px;align-items:center;margin:6px 0;font-size:15px;}
.mode-section-title { font-weight: 600; margin-bottom: 8px; }
