@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap");

:root {
  --blue: #1a4fa0;
  --blue-dark: #0d3268;
  --blue-light: #e8f0fc;
  --yellow: #f5c518;
  --yellow-dark: #d4a80f;
  --white: #ffffff;
  --gray-100: #f4f6fb;
  --gray-200: #e2e8f2;
  --gray-600: #5c6478;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --shadow: 0 8px 32px rgba(13, 50, 104, 0.1);
  --shadow-sm: 0 2px 12px rgba(13, 50, 104, 0.08);
  --touch-min: 44px;
  --header-h: 4.5rem;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--blue-dark);
  background: linear-gradient(165deg, var(--gray-100) 0%, #e8eef9 42%, #fff9e6 100%);
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: var(--safe-bottom);
}

a {
  color: var(--blue);
}

.site-header {
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue) 100%);
  color: var(--white);
  padding: calc(0.75rem + var(--safe-top)) 1rem 0.75rem;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 200;
}

.site-header .inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.site-header .inner.has-nav-toggle {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "brand toggle"
    "panel panel";
  align-items: center;
}

.site-header .brand {
  grid-area: brand;
}

.nav-toggle {
  grid-area: toggle;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: var(--touch-min);
  height: var(--touch-min);
  padding: 10px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.nav-toggle-bar {
  display: block;
  height: 2px;
  background: var(--white);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

body.nav-open .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

body.nav-open .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

body.nav-open .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.header-nav-panel {
  grid-area: panel;
  display: none;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  padding: 0.75rem 0 0.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  margin-top: 0.5rem;
}

.header-nav-panel.open {
  display: flex;
}

@media (min-width: 900px) {
  .site-header .inner.has-nav-toggle {
    display: flex;
    flex-wrap: wrap;
  }

  .nav-toggle {
    display: none;
  }

  .header-nav-panel {
    display: flex !important;
    flex-direction: row;
    flex: 1;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    border: none;
    margin: 0;
    padding: 0;
    gap: 1rem;
  }
}

.backend-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch-min);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-pill);
  text-decoration: none;
  color: rgba(255, 255, 255, 0.92);
  border: 2px solid transparent;
  font-weight: 600;
  font-size: 0.95rem;
}

@media (max-width: 899px) {
  body.nav-open {
    overflow: hidden;
  }

  .backend-nav {
    flex-direction: column;
    width: 100%;
  }

  .backend-nav .nav-tab {
    width: 100%;
    justify-content: flex-start;
    background: rgba(255, 255, 255, 0.06);
  }

  .header-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch !important;
  }

  .header-actions .btn-header-logout {
    width: 100%;
    min-height: var(--touch-min);
  }

  .user-badge {
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
  }
}

.nav-tab:hover {
  border-color: var(--yellow);
  color: var(--white);
}

.nav-tab-active {
  background: var(--yellow);
  color: var(--blue-dark);
}

.header-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  color: inherit;
}

.brand img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid var(--yellow);
  background: var(--white);
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .brand img {
    width: 72px;
    height: 72px;
  }
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.25rem, 4vw, 1.75rem);
  letter-spacing: 0.04em;
}

.brand .tagline {
  display: none;
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  opacity: 0.92;
}

@media (min-width: 640px) {
  .brand .tagline {
    display: block;
    font-size: 0.95rem;
  }
}

.brand h1 span {
  color: var(--yellow);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: var(--touch-min);
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--yellow);
  color: var(--blue-dark);
  box-shadow: 0 4px 0 var(--yellow-dark);
}

.btn-primary:hover {
  box-shadow: 0 5px 12px rgba(245, 197, 24, 0.45);
}

.btn-secondary {
  background: transparent;
  color: var(--white);
  border: 2px solid var(--yellow);
}

.btn-header-logout {
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
  border: 2px solid rgba(255, 255, 255, 0.35);
}

.btn-outline {
  background: var(--white);
  color: var(--blue);
  border: 2px solid var(--blue);
  box-shadow: none;
}

.btn-outline:hover {
  background: var(--blue-light);
}

.btn-ghost {
  background: var(--gray-100);
  color: var(--blue-dark);
  border: 2px solid var(--gray-200);
}

.btn-danger {
  background: #c62828;
  color: var(--white);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2.5rem;
}

@media (min-width: 640px) {
  .container {
    padding: 2rem 1.5rem 3rem;
  }
}

.hero {
  text-align: center;
  padding: 2rem 0.5rem 3rem;
}

.hero-badge {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-pill);
  background: var(--white);
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1rem;
}

.hero h2 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  color: var(--blue);
  margin-bottom: 0.75rem;
}

.hero p {
  max-width: 560px;
  margin: 0 auto 2rem;
  color: var(--gray-600);
  line-height: 1.6;
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
}

.card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(26, 79, 160, 0.08);
  border-top: 4px solid var(--yellow);
  transition: box-shadow 0.2s, transform 0.2s;
}

.card:hover {
  box-shadow: var(--shadow);
}

.card h3 {
  margin-top: 0;
  color: var(--blue);
}

.login-box {
  max-width: 400px;
  margin: 2rem auto;
  background: var(--white);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(26, 79, 160, 0.12);
}

.login-box h2 {
  margin-top: 0;
  text-align: center;
  color: var(--blue);
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  min-height: var(--touch-min);
  padding: 0.65rem 0.85rem;
  border: 2px solid #d0d8ea;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-family: inherit;
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group textarea {
  min-height: 5rem;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26, 79, 160, 0.15);
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-error {
  background: #ffebee;
  color: #b71c1c;
}

.dashboard-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding: 0.75rem 0;
  position: sticky;
  top: calc(var(--header-h) + var(--safe-top));
  z-index: 30;
  background: linear-gradient(180deg, #f4f6fb 85%, transparent);
}

.dashboard-toolbar h2 {
  font-size: clamp(1.15rem, 3.5vw, 1.5rem);
}

.fab-bloc {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: calc(1.25rem + var(--safe-bottom));
  z-index: 150;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0;
  box-shadow: 0 6px 24px rgba(13, 50, 104, 0.25);
  display: none;
}

@media (max-width: 640px) {
  .fab-bloc {
    display: inline-flex;
  }

  .dashboard-toolbar #btn-new-bloc {
    display: none;
  }
}

.user-badge {
  font-size: 0.9rem;
  color: var(--gray-600);
}

.blocs-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 540px) {
  .blocs-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
  }
}

.bloc-card {
  background: var(--white);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.bloc-card-cover {
  position: relative;
  flex-shrink: 0;
}

.bloc-card-cover img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: var(--gray-100);
  display: block;
}

.bloc-card-type-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  max-width: calc(100% - 1rem);
  padding: 0.3rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: right;
  color: var(--blue-dark);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(13, 50, 104, 0.15);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  pointer-events: none;
}

.bloc-card .body {
  padding: 1rem;
  flex: 1;
}

.bloc-card h3 {
  margin: 0 0 0.35rem;
  color: var(--blue);
}

.bloc-card .address {
  font-size: 0.85rem;
  color: var(--gray-600);
  margin-bottom: 0.75rem;
}

.bloc-card .actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(13, 50, 104, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  padding-bottom: calc(1rem + var(--safe-bottom));
  overscroll-behavior: contain;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  max-height: min(90vh, 90dvh);
  overflow-y: auto;
  padding: 1.25rem;
  border-top: 5px solid var(--yellow);
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 640px) {
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal-backdrop.open .modal {
    max-width: none;
    width: 100%;
    max-height: 94dvh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding-bottom: calc(1.25rem + var(--safe-bottom));
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions .btn {
    width: 100%;
  }
}

.modal.wide {
  max-width: 720px;
}

.modal h2 {
  margin-top: 0;
  color: var(--blue);
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

.autocomplete-wrap {
  position: relative;
}

.autocomplete-list {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  background: var(--white);
  border: 2px solid var(--blue);
  border-radius: 0 0 8px 8px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 10;
  display: none;
}

.autocomplete-list.show {
  display: block;
}

.autocomplete-list button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.75rem;
  border: none;
  background: var(--white);
  cursor: pointer;
  font-size: 0.9rem;
}

.autocomplete-list button:hover {
  background: var(--gray-100);
}

table.locataires {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.locataires th,
table.locataires td {
  padding: 0.5rem;
  text-align: left;
  border-bottom: 1px solid #e0e6f0;
}

table.locataires th {
  background: var(--gray-100);
  color: var(--blue);
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-600);
}

.site-footer {
  text-align: center;
  padding: 2rem;
  font-size: 0.85rem;
  color: var(--gray-600);
}

.hidden {
  display: none !important;
}

.settings-intro {
  color: var(--gray-600);
  margin: -0.5rem 0 1.25rem;
}

.settings-card {
  border-top-width: 4px;
}

.page-checkboxes {
  border: none;
  padding: 0;
  margin: 0 0 1rem;
}

.page-checkboxes legend {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--blue);
}

.checkbox-row {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin-bottom: 0.65rem;
  cursor: pointer;
}

.checkbox-row small {
  display: block;
  color: var(--gray-600);
  font-weight: normal;
}

.btn-compact {
  min-height: 36px;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  margin: 0.2rem 0.2rem 0.2rem 0;
}

@media (max-width: 640px) {
  .invite-cell .btn-compact {
    min-height: var(--touch-min);
    flex: 1 1 auto;
  }
}

.user-actions {
  white-space: nowrap;
}

.hint {
  font-size: 0.85rem;
  color: var(--gray-600);
  margin: 0.35rem 0 0.75rem;
}

.card-meta {
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  color: var(--gray-600);
}

.detail-modal {
  max-width: 920px;
  max-height: min(92vh, 900px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 1.25rem;
}

.detail-modal.modal {
  overflow: hidden;
}

.detail-modal-head {
  flex-shrink: 0;
}

.detail-modal > .detail-panel,
.detail-modal > .detail-panel-active {
  flex: 1;
  overflow-y: auto;
  padding-right: 0.25rem;
  min-height: 0;
}

.detail-modal > .modal-actions {
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid #e0e6f0;
}

.detail-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 1rem 0 0;
  padding: 0.35rem;
  background: linear-gradient(180deg, #eef2fa 0%, #e4eaf6 100%);
  border-radius: 14px;
  border: 1px solid #c5d0e8;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.detail-tab {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.55rem 0.9rem;
  min-height: var(--touch-min, 44px);
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s, transform 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.detail-tab:hover {
  background: rgba(255, 255, 255, 0.55);
}

.detail-tab:active {
  transform: scale(0.98);
}

.detail-tab:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 2px;
}

.detail-tab.detail-tab-active {
  background: var(--white);
  color: var(--blue-dark);
  box-shadow: 0 2px 10px rgba(13, 50, 104, 0.15);
}

.detail-modal > .modal-actions {
  gap: 0.65rem;
}

.detail-modal > .modal-actions .btn {
  min-width: 8.5rem;
}

.detail-modal > .modal-actions .btn-danger {
  box-shadow: 0 4px 0 #9a1f1f;
}

.detail-modal > .modal-actions .btn-outline {
  border-width: 2px;
  box-shadow: 0 2px 0 #c5d0e8;
}

.detail-panel[hidden] {
  display: none !important;
}

.occupation-resume {
  font-weight: 600;
  font-size: 0.95rem;
  margin-top: 0.5rem;
}

.occupation-resume.is-occupe {
  color: #1a6b3c;
}

.occupation-resume.is-vacant {
  color: #9a4b00;
}

.bloc-occ-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  vertical-align: middle;
  margin-left: 0.35rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: #e8ecf4;
  color: var(--gray-600);
}

.bloc-occ-badge.occupe {
  background: #d4edda;
  color: #1a6b3c;
}

.form-group-full {
  grid-column: 1 / -1;
}

.detail-cover-wrap {
  position: relative;
  margin-bottom: 0.5rem;
  border-radius: 12px;
  overflow: hidden;
  background: var(--blue);
}

.detail-cover {
  width: 100%;
  max-height: 220px;
  min-height: 120px;
  object-fit: cover;
  display: block;
}

.detail-cover-actions {
  position: absolute;
  right: 0.65rem;
  bottom: 0.65rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
}

.detail-cover-btn {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.detail-photo-hint {
  margin: 0 0 0.75rem;
}

.bloc-adresses-unites {
  margin-bottom: 0.5rem;
}

.bloc-addr-unit + .bloc-addr-unit {
  margin-top: 0.35rem;
}

.bloc-type-summary {
  font-size: 1rem;
  color: var(--blue);
}

.tag-commercial {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.12rem 0.4rem;
  margin-left: 0.35rem;
  border-radius: 4px;
  background: #fff3e0;
  color: #e65100;
  vertical-align: middle;
}

.tag-residentiel {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.12rem 0.4rem;
  margin-left: 0.35rem;
  border-radius: 4px;
  background: #e8f5e9;
  color: #2e7d32;
  vertical-align: middle;
}

.bail-jul-preview {
  margin-top: 0.35rem;
  font-weight: 600;
  color: var(--blue);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.detail-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid #e0e6f0;
}

.detail-section:last-of-type {
  border-bottom: none;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.detail-section h3 {
  margin: 0 0 0.75rem;
  color: var(--blue);
}

.adresses-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.adresse-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #eef1f7;
  font-size: 0.9rem;
}

.inline-form .form-group {
  margin-bottom: 0.5rem;
}

.logements-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.logement-card {
  background: var(--gray-100);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #dce3f0;
}

.logement-photos {
  display: flex;
  gap: 2px;
  height: 100px;
  background: #dde5f2;
}

.logement-photos img {
  flex: 1;
  object-fit: cover;
  min-width: 0;
  height: 100%;
}

.logement-body {
  padding: 0.75rem;
  font-size: 0.9rem;
}

.logement-body h4 {
  margin: 0 0 0.35rem;
  color: var(--blue);
}

.badge-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
  font-size: 0.82rem;
  color: var(--gray-600);
}

.logement-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
  align-items: center;
}

.assign-loc-select {
  flex: 1;
  min-width: 140px;
  padding: 0.35rem;
  border-radius: 6px;
  border: 1px solid #ccd4e4;
  font-size: 0.8rem;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.panel-form {
  background: #f8fafd;
  padding: 1rem;
  border-radius: 10px;
  border: 1px solid #e2e8f2;
}

@media (max-width: 640px) {
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
}

.login-choice {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin: 2rem auto;
  max-width: 720px;
}

.login-choice-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.5rem;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  background: var(--white);
  box-shadow: var(--shadow);
  border-top: 5px solid var(--yellow);
  transition: transform 0.15s;
}

.login-choice-card:hover {
  transform: translateY(-3px);
}

.login-choice-card h3 {
  margin: 0;
  color: var(--blue);
}

.login-choice-owner {
  border-top-color: var(--yellow);
}

.login-choice-tenant {
  border-top-color: var(--blue);
}

.login-choice-card .btn {
  margin-top: auto;
  align-self: flex-start;
}

.login-choice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: auto;
  width: 100%;
}

.login-choice-actions .btn {
  flex: 1 1 140px;
}

article.login-choice-card {
  text-decoration: none;
  color: inherit;
}

.brand-inline span,
.hero-title span span {
  color: var(--yellow);
}

.tag-shared {
  font-size: 0.75rem;
  background: var(--blue-light);
  color: var(--blue);
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-pill);
}

.coowner-ul,
.coowner-invite-ul {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
}

.coowner-ul li,
.coowner-invite-ul li {
  margin-bottom: 0.5rem;
}

.coowner-banner ul {
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.transfer-code-card {
  margin-bottom: 1.25rem;
}

.transfer-code-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 0.75rem 0;
}

.transfer-code-value {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--blue);
  background: #f0f4fc;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
}

.transfer-recipient-box {
  margin: 1rem 0;
  padding: 1rem;
  background: #fff9e6;
  border: 1px solid var(--yellow);
  border-radius: var(--radius-sm);
}

.transfer-recipient-box strong {
  color: var(--blue);
  font-size: 1.05rem;
}

.transfert-actions {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.coowner-invite-form {
  margin-top: 0.75rem;
}

.portail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.portail-card h2,
.portail-card h3 {
  color: var(--blue);
  margin-top: 0;
}

.pay-status {
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  margin: 0.75rem 0;
  font-size: 0.95rem;
}

.pay-ok {
  background: #e8f5e9;
  color: #2e7d32;
}

.pay-late {
  background: #ffebee;
  color: #c62828;
}

.portail-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.portail-photos img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
}

.invite-cell {
  min-width: 200px;
}

.invite-email {
  width: 100%;
  max-width: 180px;
  padding: 0.35rem;
  margin-bottom: 0.25rem;
  border: 1px solid #ccd4e4;
  border-radius: 6px;
  font-size: 0.8rem;
}

.toggle-pay.pay-ok {
  background: #e8f5e9;
  color: #2e7d32;
  border: none;
}

.toggle-pay.pay-late,
.pay-badge.pay-late {
  background: #ffebee;
  color: #c62828;
  border: none;
}

.pay-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.8rem;
}

.pay-badge.pay-ok {
  background: #e8f5e9;
  color: #2e7d32;
}

.paiement-row {
  display: grid;
  grid-template-columns: 5rem 1fr 1fr auto auto;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.registre-results {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.registre-detail {
  margin-top: 1.5rem;
}

.registre-detail-card h4 {
  margin-top: 1.25rem;
  color: var(--blue);
}

.avis-block {
  border-left: 3px solid var(--yellow);
  padding-left: 0.75rem;
  margin-bottom: 0.75rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--white);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--blue);
}

.stat-card small {
  display: block;
  font-size: 0.75rem;
  color: var(--gray-600);
  margin-top: 0.25rem;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--gray-600);
}

.stat-value {
  display: block;
  font-size: 1.25rem;
  color: var(--blue);
  margin-top: 0.15rem;
}

.stat-highlight {
  border-top-color: var(--yellow);
  background: linear-gradient(180deg, #fff9e6 0%, #fff 100%);
}

.finances-summary {
  background: #f0f5ff;
  padding: 1rem;
  border-radius: 8px;
  border-left: 4px solid var(--yellow);
}

.finances-grid p {
  margin: 0.35rem 0;
}

.finance-net {
  font-size: 1.05rem;
  margin-top: 0.5rem !important;
}

.depenses-list {
  margin-bottom: 1rem;
}

.depense-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid #e8edf5;
  font-size: 0.9rem;
}

.loyer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.loyer-edit {
  width: 6rem;
  padding: 0.25rem;
  border: 1px solid #ccd4e4;
  border-radius: 6px;
}

/* ——— Tableau locataires : cartes sur mobile ——— */
.locataires-wrap {
  width: 100%;
}

@media (max-width: 768px) {
  table.locataires.locataires-responsive thead {
    display: none;
  }

  table.locataires.locataires-responsive tbody tr {
    display: block;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
  }

  table.locataires.locataires-responsive tbody td {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.95rem;
  }

  table.locataires.locataires-responsive tbody td:last-child {
    border-bottom: none;
    flex-direction: column;
    align-items: stretch;
  }

  table.locataires.locataires-responsive tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--blue);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    flex: 0 0 100%;
  }

  table.locataires.locataires-responsive .invite-cell {
    min-width: 0;
  }

  table.locataires.locataires-responsive .invite-email {
    max-width: none;
  }
}

@media (max-width: 640px) {
  .paiement-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
    padding: 0.75rem;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    margin-bottom: 0.65rem;
  }

  .paiement-mois {
    font-weight: 700;
    color: var(--blue);
  }

  .depense-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .detail-modal {
    padding: 1rem;
  }

  .detail-tabs {
    gap: 0.25rem;
    padding: 0.3rem;
  }

  .detail-tab {
    flex: 1 1 calc(33.333% - 0.25rem);
    font-size: 0.78rem;
    padding: 0.5rem 0.35rem;
    text-align: center;
  }

  .detail-modal > .modal-actions {
    flex-direction: column-reverse;
  }

  .detail-modal > .modal-actions .btn {
    width: 100%;
    min-width: 0;
  }

  .login-choice-card .btn {
    width: 100%;
    align-self: stretch;
  }
}

/* Page d'accueil */
.login-choice-card .hint a {
  font-weight: 600;
}

.features .card p {
  margin-bottom: 0;
  color: var(--gray-600);
}

.public-header-minimal .inner {
  justify-content: center;
}

.profile-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  background: linear-gradient(90deg, #fff9e6, #fff);
  border: 1px solid var(--yellow);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.profile-banner p {
  margin: 0;
}

.profile-welcome {
  background: #e8f0fc;
  color: var(--blue-dark);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}

.owner-contact-card {
  border-top-color: var(--blue);
}

.owner-contact-card .owner-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--blue);
  margin: 0.25rem 0 0.75rem;
}

.owner-contact-card .contact-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  text-decoration: none;
  padding: 0.35rem 0;
  min-height: var(--touch-min);
}

.owner-contact-card .contact-link:hover {
  text-decoration: underline;
}

.owner-contact-missing {
  border-top-color: var(--gray-200);
  opacity: 0.95;
}

.hp-field {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.inscription-home-section {
  margin: 2.5rem auto 2rem;
  max-width: 540px;
  scroll-margin-top: 5rem;
}

.inscription-home-section > h2 {
  text-align: center;
  color: var(--blue);
  margin-bottom: 0.35rem;
}

.inscription-page {
  max-width: 540px;
}

.inscription-form {
  padding: 1.35rem !important;
  text-align: left;
}

.inscription-form-title {
  margin: 0 0 0.35rem;
  color: var(--blue);
  font-size: 1.2rem;
}

.inscription-submit {
  width: 100%;
  margin-top: 0.5rem;
}

.inscription-login-link {
  text-align: center;
  margin-top: 1rem !important;
}

.captcha-block {
  background: var(--gray-100);
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
}

.captcha-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.captcha-row input {
  flex: 1;
  min-width: 6rem;
}

.cf-turnstile {
  margin-top: 0.35rem;
}

.logement-historique {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--gray-200);
}

.logement-historique h5 {
  margin: 0 0 0.5rem;
  color: var(--blue);
  font-size: 0.95rem;
}

.historique-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.historique-item {
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.hist-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem;
  align-items: baseline;
}

.hist-notes-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.35rem 0;
}

.hist-note-pill {
  font-size: 0.75rem;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-pill);
  padding: 0.15rem 0.5rem;
}

.hist-comment,
.hist-extra {
  margin: 0.25rem 0;
}

@media (min-width: 640px) {
  .public-header-minimal .inner {
    justify-content: flex-start;
  }
}
