:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --panel: #ffffff;
  --ink: #18211f;
  --muted: #6a746f;
  --line: #dfe4df;
  --soft: #eef2ed;
  --green: #1f6b55;
  --green-dark: #174f41;
  --teal: #1d7b83;
  --gold: #b7791f;
  --red: #b42318;
  --blue: #345f9f;
  --shadow: 0 14px 40px rgba(24, 33, 31, 0.08);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

#app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 14px;
  background: #16231f;
  color: #f8fbf8;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: #d7b56d;
  color: #12201c;
  font-weight: 800;
}

.brand strong,
.brand small,
.agency-card small,
.agency-card span {
  display: block;
}

.brand small {
  color: #adbbb6;
  margin-top: 2px;
}

nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: #c9d4cf;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.nav-icon {
  width: 22px;
  text-align: center;
  color: #d7b56d;
}

.agency-card {
  margin-top: auto;
  padding: 14px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 4px;
}

.agency-card small,
.agency-card span {
  color: #adbbb6;
}

.shell {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: 86px;
  padding: 16px 28px;
  background: rgba(246, 247, 244, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 26px;
}

h2 {
  margin-bottom: 3px;
  font-size: 17px;
}

h3 {
  margin-bottom: 6px;
  font-size: 15px;
}

p,
small,
span {
  line-height: 1.35;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: min(100%, 560px);
}

.user-button {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-menu-wrap {
  position: relative;
  display: inline-flex;
}

.user-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 40;
  width: 240px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
  display: grid;
  gap: 4px;
}

.user-menu div {
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

.user-menu strong,
.user-menu small {
  display: block;
}

.user-menu small {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-menu button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-weight: 800;
}

.user-menu button:hover {
  background: var(--soft);
}

.compact-action {
  min-height: 34px;
  padding: 8px 10px;
  font-size: 12px;
}

.muted-cell {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.search-box {
  flex: 1;
  min-width: 240px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
}

.primary-button,
.ghost-button,
.icon-button {
  height: 42px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.primary-button {
  padding: 0 14px;
  background: var(--green);
  color: #ffffff;
  font-weight: 700;
}

.ghost-button {
  padding: 0 12px;
  background: #ffffff;
  border-color: var(--line);
  color: var(--ink);
}

.danger-button {
  height: 42px;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid #f3b4ae;
  background: #fff7f6;
  color: var(--red);
  font-weight: 800;
}

.icon-button {
  width: 42px;
  background: #ffffff;
  border-color: var(--line);
  color: var(--green);
  font-weight: 800;
}

.button-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toast {
  position: fixed;
  top: 96px;
  right: 28px;
  z-index: 20;
  max-width: 360px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
  font-weight: 750;
}

.toast.success {
  border-left: 4px solid var(--green);
}

.content {
  padding: 24px 28px 36px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.compact-kpis {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.kpi,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.kpi {
  min-height: 112px;
  padding: 15px;
  display: grid;
  align-content: space-between;
  border-top: 3px solid var(--green);
}

.kpi span,
.kpi small,
.panel-header p,
td small,
.lead-card span,
.task-card span,
.task-card small,
.detail-title p,
.bar-row span,
.team-list small,
.city-grid span {
  color: var(--muted);
}

.kpi strong {
  font-size: 24px;
  letter-spacing: 0;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.kpi.info {
  border-top-color: var(--teal);
}

.kpi.warn,
.kpi.money {
  border-top-color: var(--gold);
}

.kpi.danger {
  border-top-color: var(--red);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}

.span-4 {
  grid-column: span 4;
}

.span-5 {
  grid-column: span 5;
}

.span-6 {
  grid-column: span 6;
}

.span-7 {
  grid-column: span 7;
}

.span-8 {
  grid-column: span 8;
}

.span-12 {
  grid-column: span 12;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-header p {
  margin-bottom: 0;
  font-size: 13px;
}

.pipeline {
  min-height: 250px;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.stage {
  min-width: 0;
  display: grid;
  gap: 7px;
  align-items: end;
}

.stage-bar {
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #1f6b55, #d7b56d);
}

.stage span,
.stage small {
  font-size: 12px;
  color: var(--muted);
}

.quick-grid {
  display: grid;
  gap: 10px;
}

.quick-grid button {
  height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  color: var(--ink);
  text-align: left;
  padding: 0 12px;
  font-weight: 700;
}

.activity-list,
.task-stack,
.transaction-list,
.bar-list,
.team-list {
  display: grid;
  gap: 10px;
}

.activity,
.task-card,
.transaction-card,
.team-list article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.activity {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 12px;
  padding: 12px;
}

.activity time {
  color: var(--green);
  font-weight: 800;
}

.activity span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.task-card,
.transaction-card {
  padding: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.task-card time,
.task-card small {
  display: block;
  text-align: right;
}

.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px;
  align-items: start;
}

.detail-panel {
  position: sticky;
  top: 110px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  background: #fbfcfb;
}

td small {
  display: block;
  margin-top: 3px;
}

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2ed;
  color: #40504b;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.actif,
.badge.signe,
.badge.qualifie,
.badge.paye,
.badge.verifie {
  background: #e2f3ec;
  color: var(--green-dark);
}

.badge.chaud,
.badge.sous-offre,
.badge.reserve,
.badge.en-revision,
.badge.planifie {
  background: #fff3d9;
  color: #87540e;
}

.badge.en-retard,
.badge.haute {
  background: #fde8e5;
  color: var(--red);
}

.badge.brouillon,
.badge.nouveau,
.badge.en-attente {
  background: #e9f0fb;
  color: var(--blue);
}

meter {
  width: 86px;
  height: 8px;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: #e8d6a4;
  color: #332812;
  display: grid;
  place-items: center;
  font-weight: 900;
  flex: 0 0 auto;
}

.detail-list {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px 14px;
  margin: 0 0 18px;
}

.detail-list.two {
  grid-template-columns: 110px 1fr;
}

dt {
  color: var(--muted);
  font-size: 13px;
}

dd {
  margin: 0;
  font-weight: 650;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-list span {
  padding: 7px 9px;
  border-radius: 999px;
  background: var(--soft);
  color: #34423e;
  font-size: 13px;
  font-weight: 700;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 14px;
  align-items: start;
}

.kanban-col {
  min-height: 420px;
}

.lead-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
  background: #fff;
  display: grid;
  gap: 8px;
}

.lead-card p {
  margin-bottom: 0;
  font-size: 13px;
}

.module-toolbar {
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.segmented button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
}

.segmented button.active {
  background: #16231f;
  color: #fff;
}

.segmented.compact {
  flex-wrap: nowrap;
}

.filter-toggle.active {
  border-color: rgba(31, 107, 85, 0.35);
  background: #ecf6f1;
  color: var(--green);
}

.listing-filters {
  margin-bottom: 14px;
}

.filter-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.filter-group {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
}

.filter-group legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.filter-group div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-group label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.filter-group input {
  accent-color: var(--green);
}

.listing-card-actions {
  margin-top: 8px;
  justify-content: flex-start;
}

.link-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--green);
  font-weight: 800;
  text-align: left;
}

.listing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.listing-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}

.listing-card > div:last-child {
  padding: 12px;
}

.property-visual {
  min-height: 116px;
  position: relative;
  overflow: hidden;
  background: #d8dfdc;
}

.property-photo {
  min-height: 116px;
  margin: 0;
  position: relative;
  overflow: hidden;
  background: #d8dfdc;
}

.property-photo img {
  width: 100%;
  height: 100%;
  min-height: 116px;
  display: block;
  object-fit: cover;
}

.property-photo figcaption {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 1;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: #15201d;
  font-size: 12px;
  font-weight: 850;
}

.operation-tag {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 2;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(22, 35, 31, 0.86);
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.operation-tag.location,
.operation-tag.location-saisonniere {
  background: rgba(29, 123, 131, 0.92);
}

.property-photo.thumb .operation-tag,
.property-visual.thumb .operation-tag {
  right: 6px;
  top: 6px;
  padding: 3px 6px;
  font-size: 10px;
}

.property-photo.large {
  min-height: 250px;
  border-radius: var(--radius);
  margin-bottom: 14px;
}

.property-photo.clickable {
  cursor: zoom-in;
}

.property-photo.clickable::after {
  content: "Agrandir";
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(18, 35, 31, 0.78);
  color: #ffffff;
  font-size: 12px;
  font-weight: 850;
}

.property-photo.large img {
  min-height: 250px;
}

.property-photo.thumb {
  width: 78px;
  min-height: 56px;
  height: 56px;
  border-radius: 6px;
}

.property-photo.thumb img {
  min-height: 56px;
}

.property-photo.thumb figcaption {
  display: none;
}

.property-visual.thumb {
  width: 78px;
  min-height: 56px;
  height: 56px;
  border-radius: 6px;
}

.property-visual.thumb::before {
  height: 36px;
}

.property-visual.thumb::after,
.property-visual.thumb span {
  display: none;
}

.property-visual::before,
.property-visual::after {
  content: "";
  position: absolute;
  inset: auto 18px 0;
  height: 74px;
  background:
    linear-gradient(90deg, transparent 12px, rgba(255, 255, 255, 0.55) 12px 20px, transparent 20px 34px) repeat-x,
    rgba(255, 255, 255, 0.26);
  background-size: 46px 100%;
  clip-path: polygon(0 28%, 20% 0, 48% 22%, 70% 5%, 100% 30%, 100% 100%, 0 100%);
}

.property-visual::after {
  inset: auto 0 0 auto;
  width: 38%;
  height: 92px;
  opacity: 0.45;
}

.property-visual span {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 1;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: #15201d;
  font-size: 12px;
  font-weight: 850;
}

.property-visual.large {
  min-height: 190px;
  border-radius: var(--radius);
  margin-bottom: 14px;
}

.photo-meta {
  margin: 0 0 18px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--soft);
  display: grid;
  gap: 2px;
}

.photo-meta span {
  color: var(--ink);
  font-weight: 800;
}

.photo-meta small {
  color: var(--muted);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: -6px 0 18px;
}

.gallery-grid figure {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}

.gallery-button {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  display: block;
  cursor: zoom-in;
}

.gallery-grid img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.gallery-button img {
  transition: transform 160ms ease;
}

.gallery-button:hover img {
  transform: scale(1.03);
}

.gallery-grid figcaption {
  padding: 7px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.property-visual.casablanca,
.property-visual.office {
  background: linear-gradient(135deg, #d9e5e2, #8db3b2);
}

.property-visual.rabat,
.property-visual.anfa {
  background: linear-gradient(135deg, #e8dcbf, #8fad91);
}

.property-visual.marrakech {
  background: linear-gradient(135deg, #ead0ba, #c28463);
}

.property-visual.tanger {
  background: linear-gradient(135deg, #cfe0e5, #6e99b5);
}

.property-visual.agadir {
  background: linear-gradient(135deg, #e6d9b6, #6ba7a0);
}

.detail-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.detail-actions {
  display: flex;
  gap: 8px;
  margin: -4px 0 16px;
}

.lightbox-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(7, 13, 12, 0.86);
}

.lightbox {
  width: min(1180px, 100%);
  max-height: calc(100vh - 44px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border-radius: var(--radius);
  overflow: hidden;
  background: #111b18;
  color: #ffffff;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.45);
}

.lightbox-header,
.lightbox-footer {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #14211d;
}

.lightbox-header h2 {
  margin-bottom: 2px;
  color: #ffffff;
}

.lightbox-header p {
  margin-bottom: 0;
  color: #b7c3bf;
}

.lightbox-close {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.18);
}

.lightbox-stage {
  min-height: 420px;
  position: relative;
  display: grid;
  place-items: center;
  background: #07100e;
}

.lightbox-stage img {
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 210px);
  object-fit: contain;
  display: block;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 68px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-size: 42px;
  line-height: 1;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.18);
}

.lightbox-nav.prev {
  left: 18px;
}

.lightbox-nav.next {
  right: 18px;
}

.lightbox-footer strong {
  min-width: 160px;
  color: #ffffff;
}

.lightbox-strip {
  min-width: 0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  justify-content: flex-end;
}

.lightbox-strip button {
  width: 74px;
  height: 54px;
  flex: 0 0 auto;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  background: transparent;
}

.lightbox-strip button.active {
  border-color: #d7b56d;
}

.lightbox-strip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.transaction-card {
  align-items: stretch;
}

.transaction-card p {
  margin-bottom: 5px;
  color: var(--muted);
}

.transaction-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 8px;
  min-width: 520px;
}

.transaction-metrics span {
  padding: 10px;
  border-radius: var(--radius);
  background: var(--soft);
}

.transaction-metrics strong,
.transaction-metrics small {
  display: block;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.calendar-grid div {
  min-height: 104px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: #fbfcfb;
  display: grid;
  align-content: start;
  gap: 6px;
}

.calendar-grid span {
  font-size: 22px;
  font-weight: 850;
}

.bar-row {
  display: grid;
  gap: 7px;
}

.bar-row div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.bar-row i {
  display: block;
  height: 9px;
  min-width: 6px;
  border-radius: 999px;
  background: var(--green);
}

.conversion-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.conversion-row div,
.city-grid article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfb;
}

.conversion-row strong {
  display: block;
  font-size: 28px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.form-grid label {
  display: grid;
  gap: 6px;
}

.form-grid span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.form-grid input {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 10px;
  color: var(--ink);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(18, 32, 28, 0.42);
}

.modal {
  width: min(920px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(18, 32, 28, 0.24);
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.modal-header p {
  margin-bottom: 0;
  color: var(--muted);
}

.record-form {
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.record-form.is-submitting {
  opacity: 0.72;
  pointer-events: none;
}

.form-field {
  display: grid;
  gap: 6px;
}

.form-field.wide {
  grid-column: 1 / -1;
}

.form-field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

.form-field input[type="file"] {
  height: auto;
  padding: 10px;
}

.file-field small {
  color: var(--muted);
}

.edit-photo-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 9px;
}

.edit-photo-preview figure {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #ffffff;
}

.edit-photo-preview img {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: block;
  object-fit: cover;
}

.edit-photo-preview figcaption {
  padding: 7px 8px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.global-results {
  max-width: 1040px;
  margin: 0 auto;
}

.search-result-group + .search-result-group {
  margin-top: 24px;
}

.search-result-heading {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.search-result-heading h3 {
  margin: 0;
}

.search-result-heading > span {
  min-width: 28px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--soft);
  color: var(--green);
  font-size: 11px;
  font-weight: 850;
}

.search-result-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.search-result-list button {
  width: 100%;
  min-height: 64px;
  padding: 11px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  text-align: left;
}

.search-result-list button:last-child {
  border-bottom: 0;
}

.search-result-list button:hover {
  background: #f8faf8;
}

.search-result-list button > span:first-child {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.search-result-list strong,
.search-result-list small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-list small {
  color: var(--muted);
  font-size: 11px;
}

.search-result-list button > span:last-child {
  color: var(--green);
  font-size: 24px;
}

.choice-field {
  margin: 0;
  padding: 0;
  border: 0;
}

.choice-field legend {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.choice-grid label {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfb;
}

.choice-grid input {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}

.choice-grid span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.form-field textarea {
  min-height: 88px;
  padding: 10px;
  resize: vertical;
}

.form-error {
  margin: 16px 18px 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: #fde8e5;
  color: var(--red);
  font-weight: 800;
}

.modal-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 6px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 999px;
  animation: spin 750ms linear infinite;
}

.spinner.dark {
  border-color: rgba(31, 107, 85, 0.18);
  border-top-color: var(--green);
}

.auth-screen {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(rgba(246, 247, 244, 0.92), rgba(246, 247, 244, 0.92)),
    linear-gradient(135deg, #d9e5e2, #d7b56d);
}

.auth-card {
  width: min(460px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
  display: grid;
  gap: 18px;
}

.auth-brand {
  padding: 0 0 16px;
  color: var(--ink);
  border-bottom-color: var(--line);
}

.auth-brand small {
  color: var(--muted);
}

.auth-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form label {
  display: grid;
  gap: 6px;
}

.auth-form span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.auth-form input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 10px;
}

.auth-error {
  margin: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.team-list article {
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.team-list small {
  display: block;
  margin-top: 2px;
}

.city-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.city-grid p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.empty {
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: #fbfcfb;
}

@media (max-width: 1180px) {
  #app {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .sidebar .brand span:last-child,
  .nav-item span:last-child,
  .agency-card {
    display: none;
  }

  .sidebar {
    align-items: center;
  }

  .nav-item {
    justify-content: center;
    padding: 0;
  }

  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .split-layout {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }

  .kanban {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1380px) {
  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .pipeline {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-height: 320px;
  }
}

@media (max-width: 820px) {
  #app {
    display: block;
  }

  body {
    padding-bottom: 76px;
  }

  body:has(.auth-screen) {
    padding-bottom: 0;
  }

  .auth-screen {
    padding: 16px;
  }

  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 25;
    height: 76px;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    gap: 0;
  }

  .sidebar > .brand,
  .agency-card {
    display: none;
  }

  nav {
    display: flex;
    width: 100%;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  nav::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    min-width: 70px;
    min-height: 58px;
    padding: 6px 8px;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    font-size: 11px;
    text-align: center;
  }

  .nav-item span:last-child {
    display: block;
    max-width: 64px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav-icon {
    width: auto;
    font-size: 16px;
  }

  .topbar {
    position: sticky;
    top: 0;
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
    padding: 14px 16px 12px;
  }

  .eyebrow {
    font-size: 10px;
    margin-bottom: 2px;
  }

  h1 {
    font-size: 22px;
  }

  .top-actions {
    min-width: 0;
    display: grid;
    grid-template-columns: 44px auto minmax(0, 1fr);
    gap: 8px;
  }

  .toast {
    left: 16px;
    right: 16px;
    top: 12px;
  }

  .search-box {
    min-width: 0;
    height: 40px;
    grid-column: 1 / -1;
  }

  .primary-button,
  .ghost-button,
  .icon-button,
  .danger-button {
    height: 40px;
  }

  .top-actions .primary-button {
    grid-column: 2;
    min-width: 116px;
  }

  .top-actions .icon-button {
    grid-column: 1;
  }

  .top-actions .user-button {
    width: 100%;
    max-width: none;
    justify-content: flex-start;
  }

  .user-menu-wrap {
    grid-column: 3;
    min-width: 0;
  }

  .user-menu {
    left: auto;
    right: 0;
    width: min(280px, calc(100vw - 24px));
  }

  .content {
    padding: 14px 12px 20px;
  }

  .panel {
    padding: 14px;
  }

  .panel-header {
    gap: 10px;
    margin-bottom: 12px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .kpi {
    min-height: 104px;
    padding: 12px;
  }

  .kpi strong {
    font-size: 22px;
  }

  .compact-kpis {
    grid-template-columns: 1fr;
  }

  .compact-kpis,
  .dashboard-grid,
  .kanban,
  .pipeline,
  .transaction-metrics,
  .calendar-grid,
  .conversion-row,
  .form-grid,
  .record-form {
    grid-template-columns: 1fr;
  }

  .split-layout {
    gap: 12px;
  }

  .module-toolbar {
    gap: 10px;
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .filter-toggle {
    justify-content: flex-start;
  }

  .listing-filters {
    padding: 12px;
  }

  .filter-groups {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .filter-group {
    padding: 9px;
  }

  .filter-group div {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .filter-group div::-webkit-scrollbar {
    display: none;
  }

  .filter-group label {
    flex: 0 0 auto;
    min-height: 38px;
  }

  .segmented {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }

  .segmented::-webkit-scrollbar {
    display: none;
  }

  .segmented button {
    flex: 0 0 auto;
  }

  .table-wrap {
    overflow: visible;
  }

  table {
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  tbody {
    display: grid;
    gap: 10px;
  }

  tr {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #ffffff;
    box-shadow: 0 10px 28px rgba(24, 33, 31, 0.06);
    overflow: hidden;
  }

  td {
    min-height: 36px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--line);
  }

  td:last-child {
    border-bottom: 0;
  }

  td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 850;
    text-transform: uppercase;
  }

  td[data-label="Photo"] {
    padding: 0;
  }

  td[data-label="Photo"]::before {
    display: none;
  }

  td[data-label="Photo"] .property-photo.thumb,
  td[data-label="Photo"] .property-visual.thumb {
    width: 100%;
    height: 164px;
    min-height: 164px;
    border-radius: 0;
  }

  td[data-label="Photo"] .property-photo.thumb img {
    min-height: 164px;
  }

  td[data-label="Bien"] .link-button {
    font-size: 17px;
  }

  td[data-label="Actions"] .ghost-button {
    width: 100%;
  }

  td[data-label="Actions"] .table-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  td[data-label="Actions"] .table-actions button {
    width: 100%;
  }

  .listing-grid {
    grid-template-columns: 1fr;
  }

  .listing-card {
    box-shadow: 0 10px 28px rgba(24, 33, 31, 0.06);
  }

  .listing-card .property-photo,
  .listing-card .property-visual {
    min-height: 180px;
  }

  .listing-card .property-photo img {
    min-height: 180px;
  }

  .listing-card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .listing-card-actions .ghost-button {
    width: 100%;
  }

  .property-photo.large,
  .property-photo.large img,
  .property-visual.large {
    min-height: 220px;
  }

  .detail-panel {
    max-height: none;
  }

  .detail-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .detail-list,
  .detail-list.two {
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
  }

  .detail-list dt {
    font-size: 11px;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .modal-backdrop {
    align-items: end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-height: calc(100vh - 24px);
    border-radius: 14px 14px 0 0;
  }

  .record-form {
    padding: 14px;
  }

  .choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .edit-photo-preview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .span-4,
  .span-5,
  .span-6,
  .span-7,
  .span-8,
  .span-12 {
    grid-column: auto;
  }

  .module-toolbar,
  .task-card,
  .transaction-card,
  .detail-title,
  .lightbox-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .transaction-metrics {
    min-width: 0;
  }

  .lightbox-backdrop {
    padding: 10px;
  }

  .lightbox-stage {
    min-height: 320px;
  }

  .lightbox-nav {
    width: 42px;
    height: 56px;
    font-size: 34px;
  }

  .lightbox-nav.prev {
    left: 8px;
  }

  .lightbox-nav.next {
    right: 8px;
  }

  .lightbox-strip {
    justify-content: flex-start;
  }
}
