@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root,
[data-theme="light"] {
  --brand-dark: #0b6e4f;
  --brand-dark-hover: #095a41;
  --brand-light: #39d353;
  --brand-light-hover: #2fb844;
  --brand-soft: #e8f8ef;
  --bg: #f7faf8;
  --bg-elevated: #ffffff;
  --card: #ffffff;
  --border: #d4e8de;
  --text: #0f2922;
  --text-secondary: #3d5c52;
  --muted: #6b8f82;
  --accent: var(--brand-dark);
  --accent-hover: var(--brand-dark-hover);
  --accent-soft: var(--brand-soft);
  --accent-bright: var(--brand-light);
  --portaria: #1a7f64;
  --portaria-soft: #e0f2eb;
  --admin: var(--brand-dark);
  --admin-soft: var(--brand-soft);
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --warn: #ca8a04;
  --warn-soft: #fef9c3;
  --shadow: 0 1px 3px rgba(11, 110, 79, 0.08), 0 4px 14px rgba(11, 110, 79, 0.06);
  --shadow-lg: 0 10px 32px rgba(11, 110, 79, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --header-bg: rgba(255, 255, 255, 0.94);
}

[data-theme="dark"] {
  --brand-dark: #4ade80;
  --brand-dark-hover: #86efac;
  --brand-light: #39d353;
  --brand-light-hover: #4ade80;
  --brand-soft: #0f2922;
  --bg: #0a1410;
  --bg-elevated: #122018;
  --card: #16261e;
  --border: #2a4036;
  --text: #ecfdf5;
  --text-secondary: #a7c4b5;
  --muted: #6b8f82;
  --accent: var(--brand-light);
  --accent-hover: var(--brand-light-hover);
  --accent-soft: #0f2922;
  --accent-bright: var(--brand-light);
  --portaria: #5eead4;
  --portaria-soft: #134e3a;
  --admin: var(--brand-light);
  --admin-soft: #0f2922;
  --danger: #f87171;
  --danger-soft: #450a0a;
  --warn: #fbbf24;
  --warn-soft: #422006;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.45);
  --header-bg: rgba(10, 20, 16, 0.96);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

body {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 0.85rem 1.25rem;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}

.logo-img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: contain;
}

.logo em {
  font-style: normal;
  color: var(--brand-light);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.screen {
  display: none;
  animation: fadeIn 0.25s ease;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hero {
  text-align: center;
  margin-bottom: 1.75rem;
}

.hero h1 {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
  color: var(--brand-dark);
}

[data-theme="dark"] .hero h1 {
  color: var(--text);
}

.hero .sub {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 340px;
  margin: 0 auto;
}

.hero-logo {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  object-fit: contain;
  margin: 0 auto 1rem;
  display: block;
  box-shadow: var(--shadow-lg);
}

h2.section-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
}

.sub {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.card-highlight {
  border-color: var(--brand-light);
  background: linear-gradient(180deg, var(--brand-soft) 0%, var(--card) 45%);
}

.home-grid {
  display: grid;
  gap: 0.75rem;
}

.role-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  text-align: left;
  padding: 1.15rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  width: 100%;
}

.role-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
  border-color: var(--brand-dark);
}

.role-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
  background: var(--brand-soft);
}

.role-card h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.role-card p {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

button {
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.7rem 1.1rem;
  font-size: 0.92rem;
  font-family: inherit;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s, transform 0.1s;
}

button:active:not(:disabled) {
  transform: scale(0.98);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--brand-dark);
  color: #fff;
  width: 100%;
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-dark-hover);
}

.btn-portaria {
  background: var(--portaria);
  color: #fff;
  width: 100%;
}

.btn-admin {
  background: linear-gradient(135deg, var(--brand-dark), #12875f);
  color: #fff;
  width: 100%;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  padding: 0.4rem 0.65rem;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: var(--shadow);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-google:hover {
  background: var(--card);
  border-color: var(--brand);
}

.login-morador-card {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.login-morador-card .btn-google {
  margin-bottom: 0.35rem;
}

.login-google-hint {
  margin: 0 0 0.25rem !important;
}

.login-or-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.15rem 0 1rem;
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.login-or-divider::before,
.login-or-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.login-field-label {
  display: block;
  margin: 0.85rem 0 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.login-morador-card .login-field-label:first-of-type {
  margin-top: 0;
}

.login-morador-card .login-field,
.login-morador-card input.login-field {
  margin-top: 0;
}

.login-pin-hint {
  margin: 0.25rem 0 0.5rem !important;
}

.login-codigo-extra summary,
.login-senha-extra summary {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.login-morador-card .ac-collapse.login-senha-extra,
.login-morador-card .ac-collapse.login-codigo-extra {
  margin-top: 0.25rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.65rem;
}

.login-morador-card .ac-collapse.login-senha-extra .ac-collapse-body,
.login-morador-card .ac-collapse.login-codigo-extra .ac-collapse-body {
  padding-top: 0.35rem;
}

.login-field-btn {
  width: 100%;
  margin-top: 1.15rem;
}

.btn-whatsapp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1rem;
  margin-top: 0.75rem;
  border-radius: 10px;
  background: #25d366;
  color: #fff !important;
  font-weight: 600;
  text-decoration: none;
  border: none;
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.35);
}

.btn-whatsapp:hover {
  background: #1ebe57;
  color: #fff !important;
}

.morador-thumb {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  vertical-align: middle;
}

.morador-thumb-empty {
  display: inline-flex;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 1rem;
}

.morador-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.status-pill.pin {
  background: var(--warn-soft);
  color: var(--warn);
}

.status-pill.tg {
  background: #e3f2fd;
  color: #1565c0;
}

[data-theme="dark"] .status-pill.tg {
  background: #0d2137;
  color: #90caf9;
}

.busca-morador-resumo {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--brand-soft);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.busca-morador-resumo-inner {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.busca-morador-foto {
  width: 56px !important;
  height: 56px !important;
  border-radius: 50%;
  flex-shrink: 0;
}

.busca-morador-info strong {
  display: block;
  margin-bottom: 0.15rem;
}

.perfil-collapse {
  margin-bottom: 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.65rem;
  background: var(--card);
}

.card--nested {
  margin: 0;
  border: none;
  box-shadow: none;
  padding: 0.5rem 0 0;
}

.td-acoes-morador {
  white-space: nowrap;
}

.hide-mobile {
  display: table-cell;
}

.show-mobile-only {
  display: none;
}

@media (max-width: 640px) {
  .hide-mobile {
    display: none;
  }

  .show-mobile-only {
    display: block;
  }

  table.moradores-table {
    font-size: 0.8rem;
  }

  .td-acoes-morador .btn-sm {
    padding: 0.3rem 0.45rem;
  }
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 1.1rem;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.75rem 0.85rem;
  margin-top: 0.35rem;
  margin-bottom: 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--brand-light);
  outline-offset: 0;
  border-color: transparent;
}

label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: block;
}

.input-lg {
  font-size: 1.45rem;
  text-align: center;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.chip {
  background: var(--brand-soft);
  border: 1px solid var(--border);
  color: var(--brand-dark);
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  cursor: pointer;
  font-weight: 500;
}

.chip:hover {
  background: var(--brand-light);
  color: #fff;
  border-color: var(--brand-light);
}

.tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.25rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  overflow-x: auto;
}

.tab {
  flex: 1;
  padding: 0.6rem;
  text-align: center;
  border-radius: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
}

.tab.active {
  background: var(--card);
  color: var(--brand-dark);
  box-shadow: var(--shadow);
}

.list-item {
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 0;
}

.list-item:last-child {
  border-bottom: none;
}

.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  margin-right: 0.35rem;
  text-transform: uppercase;
}

.badge-pendente {
  background: var(--warn-soft);
  color: var(--warn);
}
.badge-ok {
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.badge-negado {
  background: var(--danger-soft);
  color: var(--danger);
}

.unit-badge {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  background: var(--brand-soft);
  color: var(--brand-dark);
  border-radius: 999px;
}

.hist-time {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  border: 1px solid var(--brand-light);
  padding: 0.8rem 1.25rem;
  border-radius: var(--radius-sm);
  z-index: 200;
  display: none;
  max-width: 92%;
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 500;
}

.toast.show {
  display: block;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 1.5rem;
  font-size: 0.88rem;
}

.info-box {
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: var(--brand-soft);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  margin-bottom: 1rem;
  border-left: 3px solid var(--brand-light);
}

.codigo-display {
  font-family: ui-monospace, monospace;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-align: center;
  padding: 0.75rem;
  background: var(--brand-soft);
  border-radius: var(--radius-sm);
  margin: 0.5rem 0 1rem;
  color: var(--brand-dark);
}

.admin-section {
  display: none;
}
.admin-section.active {
  display: block;
}

.label-block {
  margin-bottom: 0.25rem;
}

.input-search-full {
  width: 100%;
  min-height: 48px;
  font-size: 1rem;
  margin-bottom: 1rem;
}

.input-upper {
  text-transform: uppercase;
}

.input-upper::placeholder {
  text-transform: none;
}

.btn-block-spaced {
  width: 100%;
  margin-top: -0.35rem;
  margin-bottom: 1rem;
}

#perfil-tel[readonly] {
  background: var(--bg);
  color: var(--text-secondary);
  cursor: default;
}

.filters-row {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.filters-row--selects {
  grid-template-columns: 1fr 1fr;
}

.filters-row select {
  margin-bottom: 0;
  min-height: 44px;
  font-size: 0.92rem;
  width: 100%;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
  cursor: pointer;
  margin-bottom: 0.5rem;
}

.checkbox-row input {
  width: auto;
  margin: 0.2rem 0 0;
}


.count-badge {
  display: inline-block;
  background: var(--brand-dark);
  color: #fff;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  margin-left: 0.35rem;
  vertical-align: middle;
}

table.moradores-table {
  width: 100%;
  font-size: 0.85rem;
  border-collapse: collapse;
}

table.moradores-table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 0.5rem 0.35rem;
  border-bottom: 2px solid var(--border);
}

table.moradores-table td {
  padding: 0.65rem 0.35rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.moradores-table tr:hover td {
  background: var(--brand-soft);
}

.td-unidade {
  font-weight: 700;
  font-size: 1rem;
  color: var(--brand-dark);
  letter-spacing: 0.04em;
}

.status-pill {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-weight: 600;
}

.status-pill.ok {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.status-pill.wait {
  background: var(--warn-soft);
  color: var(--warn);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-weight: 500;
}

.panel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.input-with-btn {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin-bottom: 0.85rem;
}

.input-with-btn input {
  flex: 1;
  margin-bottom: 0;
}

.btn-sm {
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  white-space: nowrap;
}

.list-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.morador-portaria-item .morador-acoes {
  margin-top: 0.5rem;
  flex-wrap: nowrap;
}

.morador-acoes .btn-ghost,
.morador-acoes .btn-wa {
  flex: 1;
  width: auto;
}

.btn-row-portaria {
  flex-wrap: nowrap;
  align-items: stretch;
}

.btn-row-portaria .btn-confirmar-portaria {
  flex: 2;
  width: auto;
  min-width: 0;
}

.btn-row-portaria .btn-negar-portaria {
  flex: 1;
  width: auto;
  min-width: 0;
}

.btn-wa {
  background: #25d366;
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.btn-wa:hover:not(:disabled) {
  background: #1fb855;
}

.acesso-fixo-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.acesso-foto-btn {
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
  flex-shrink: 0;
  border-radius: 10px;
  line-height: 0;
}

.acesso-foto-btn:focus-visible {
  outline: 2px solid var(--brand-light);
  outline-offset: 2px;
}

.acesso-foto {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  display: block;
  border: 1px solid var(--border);
}

.modal-foto-overlay {
  align-items: center;
  justify-content: center;
}

.modal-foto-wrap {
  position: relative;
  z-index: 1;
  max-width: min(96vw, 520px);
  max-height: 90dvh;
  padding: 0.5rem;
}

.modal-foto-wrap img {
  width: 100%;
  max-height: 85dvh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: #000;
}

.acesso-foto--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  font-size: 1.5rem;
}

.acesso-foto-preview {
  width: 80px;
  height: 80px;
  border-radius: 10px;
  object-fit: cover;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
}

.acesso-fixo-info {
  flex: 1;
  min-width: 0;
}

.section-kicker {
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.excel-toolbar {
  flex-wrap: wrap;
}

.btn-file {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-file input {
  display: none;
}

.morador-notif-banner {
  background: #e8f5e9;
  border: 2px solid #2e7d32;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  justify-content: space-between;
}

.morador-liberar-extra {
  margin-top: 0.85rem;
}

.morador-liberar-extra > summary {
  font-size: 0.92rem;
}

.auth-loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  gap: 1rem;
  padding: 2rem 1rem;
}

.auth-loading-text {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.auth-spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: btnSpin 0.7s linear infinite;
}

.morador-notif-banner:not([hidden]) {
  animation: morador-notif-in 0.35s ease;
}

@keyframes morador-notif-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 41, 34, 0.55);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  max-height: 90dvh;
  overflow-y: auto;
  background: var(--card);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 1.5rem 1.25rem 1.25rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  animation: modalUp 0.25s ease;
}

@keyframes modalUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.modal-card--scroll {
  overflow-y: auto;
}

.modal-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}

.modal-morador-panel.ac-collapse {
  margin-bottom: 0.75rem;
}

.modal-subsecao {
  font-size: 0.88rem;
  font-weight: 700;
  margin: 0.5rem 0 0.5rem;
  color: var(--text);
}

.modal-pin-display {
  display: block;
  width: 100%;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.25em;
  font-size: 1.15rem;
  padding: 0.75rem;
  margin: 0 0 0.65rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.modal-pin-display--loading {
  animation: pinPulse 1s ease-in-out infinite;
  letter-spacing: 0.5em;
  color: var(--text-secondary);
}

@keyframes pinPulse {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

.btn-loading {
  cursor: wait;
  pointer-events: none;
  opacity: 0.92;
}

.btn-loading::before {
  content: "";
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-right: 0.45em;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btnSpin 0.65s linear infinite;
  flex-shrink: 0;
}

@keyframes btnSpin {
  to {
    transform: rotate(360deg);
  }
}

.modal-acesso-stack {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
}

.modal-acesso-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  width: 100%;
}

.modal-btn-full {
  width: 100%;
  margin: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 2.75rem;
  box-sizing: border-box;
  line-height: 1.25;
}

.modal-acesso-stack .btn-whatsapp,
a.btn-whatsapp.modal-btn-full {
  margin: 0 !important;
  text-decoration: none;
  padding: 0.75rem 1rem;
}

.modal-acesso-stack > [hidden],
.modal-acesso-row[hidden] {
  display: none !important;
}

.modal-morador-panel .ac-collapse-body .hist-time {
  text-align: center;
}

@media (max-width: 420px) {
  .modal-acesso-row {
    grid-template-columns: 1fr;
  }
}

.subsection-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.ac-collapse {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.65rem;
  background: var(--surface);
  overflow: hidden;
}

.ac-collapse:last-child {
  margin-bottom: 0;
}

.ac-collapse > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.85rem 1rem;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  user-select: none;
}

.ac-collapse > summary::-webkit-details-marker {
  display: none;
}

.ac-collapse > summary::after {
  content: "▸";
  font-size: 1rem;
  color: var(--text-secondary);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.ac-collapse[open] > summary::after {
  transform: rotate(90deg);
}

.ac-collapse-body {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--border);
}

.ac-collapse-body > label:first-child {
  margin-top: 0.75rem;
}

.gestao-painel .card {
  padding: 0.65rem;
}

.gestao-painel .card > .hist-time:first-child {
  margin: 0 0.5rem 0.35rem;
  padding: 0 0.35rem;
}

.modal-card h2 {
  font-size: 1.2rem;
  margin-bottom: 0.25rem;
  padding-right: 2rem;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

@media (min-width: 520px) {
  .modal-overlay {
    align-items: center;
  }
  .modal-card {
    border-radius: var(--radius);
  }
}

@media (min-width: 520px) {
  .filters-row {
    grid-template-columns: 1fr auto auto;
  }
}
