:root {
  color-scheme: dark;
  --ink: #f2f4f7;
  --muted: #a5acb8;
  --line: #313641;
  --panel: #171a20;
  --soft: #0d0f13;
  --field: #12151b;
  --mint: #8e96a3;
  --mint-dark: #d5d9df;
  --coral: #b9903f;
  --amber: #e0c27a;
  --primary-rgb: 185, 144, 63;
  --primary-soft: rgba(var(--primary-rgb), 0.12);
  --primary-faint: rgba(var(--primary-rgb), 0.08);
  --primary-border: rgba(var(--primary-rgb), 0.28);
  --primary-focus: rgba(var(--primary-rgb), 0.58);
  --lime: #c8ff3d;
  --sky: #9aa2ae;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.32);
  --control-width: 10rem;
  --compact-control-width: 8.75rem;
  --filter-control-gap: 24px;
  --filter-toggle-gap: 8px;
  --filter-action-width: calc(var(--control-width) / 1.8);
  --dropdown-arrow-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23d5d9df' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Dirham-Sans", sans-serif;
}

@font-face {
  font-family: "Dirham-Sans";
  src: url("assets/dirham-sans.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  unicode-range: U+20C3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--soft);
}

a {
  color: var(--mint-dark);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(260px, 640px) minmax(170px, 1fr);
  align-items: center;
  gap: 18px;
  padding: 34px clamp(18px, 4vw, 56px) 22px;
}

.brand-logo {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  width: max-content;
  color: var(--ink);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
}

.brand-logo img {
  width: 24px;
  height: 24px;
}

.brand-copy {
  display: grid;
  gap: 4px;
}

.brand-title {
  font-size: 1.5rem;
}

.brand-tagline {
  color: var(--coral);
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.1;
  text-transform: uppercase;
  white-space: nowrap;
}

.top-search-area {
  display: grid;
  gap: 8px;
  justify-self: center;
  width: 100%;
  max-width: min(640px, 44vw);
  min-width: 0;
}

.top-search {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--field);
}

.top-search:focus-within {
  border-color: rgba(213, 217, 223, 0.36);
  background: #0f1218;
}

.ask-ai-field,
.clearable-input:not(.top-search-input-wrap) {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--field);
}

.ask-ai-field:focus-within,
.clearable-input:not(.top-search-input-wrap):focus-within {
  border-color: rgba(213, 217, 223, 0.36);
  background: #0f1218;
}

.ask-ai-field input,
.clearable-input:not(.top-search-input-wrap) input {
  border: 0;
  background: transparent;
  outline: 0;
}

input[type="search"]:focus,
input[type="search"]:focus-visible {
  background: transparent;
  color: var(--ink);
  outline: 0;
}

input[type="search"]:-webkit-autofill,
input[type="search"]:-webkit-autofill:hover,
input[type="search"]:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  box-shadow: 0 0 0 1000px var(--field) inset;
}

.top-search-input-wrap {
  flex: 1 1 auto;
  min-width: 0;
}

.top-search #textSearch {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 0;
  border-radius: 999px 0 0 999px;
  background: transparent;
  padding: 0 42px 0 18px;
  outline: 0;
}

.top-search-button {
  display: inline-grid;
  place-items: center;
  align-self: stretch;
  flex: 0 0 64px;
  width: 64px;
  min-height: 42px;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: #20242c;
  color: var(--mint-dark);
}

.top-search-button:hover,
.top-search-button:focus-visible {
  background: #282d36;
}

.top-search-button:disabled {
  cursor: default;
}

.top-search-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.topbar-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
  min-width: 0;
}

.theme-picker {
  position: relative;
  display: inline-flex;
}

.theme-button,
.share-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
  min-width: 88px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--field);
  color: var(--mint-dark);
  font-size: 1rem;
  font-weight: 400;
  white-space: nowrap;
}

.theme-button:hover,
.theme-button:focus-visible,
.theme-button[aria-expanded="true"],
.share-button:hover,
.share-button:focus-visible,
.share-button[aria-expanded="true"] {
  background: #242934;
  outline: 0;
}

.theme-current-swatch,
.theme-option-swatch {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.18);
}

.theme-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 35;
  display: grid;
  gap: 4px;
  width: max-content;
  min-width: 220px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 26, 32, 0.98);
  box-shadow: var(--shadow);
}

.theme-panel[hidden] {
  display: none;
}

.theme-option {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 400;
  text-align: left;
  white-space: nowrap;
}

.theme-option:hover,
.theme-option:focus-visible,
.theme-option.active {
  background: var(--primary-soft);
  outline: 0;
}

.theme-option.active {
  color: var(--amber);
}

.theme-option-label {
  flex: 1 1 auto;
}

.share-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 30;
  width: min(520px, calc(100vw - 32px));
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 26, 32, 0.98);
  box-shadow: var(--shadow);
}

.share-panel[hidden] {
  display: none;
}

.share-close-button {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-grid;
  place-items: center;
  width: 24px;
  min-width: 0;
  height: 24px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1;
}

.share-close-button:hover,
.share-close-button:focus-visible {
  background: rgba(154, 162, 174, 0.12);
  color: var(--ink);
  outline: 0;
}

.share-link-row {
  display: flex;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--field);
}

.share-link-row:focus-within {
  border-color: rgba(213, 217, 223, 0.36);
  background: #0f1218;
}

.share-link-row input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0 14px;
  outline: 0;
}

.share-link-row button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: #20242c;
  color: var(--mint-dark);
  font-size: 0.95rem;
  font-weight: 400;
}

.share-link-row button:hover,
.share-link-row button:focus-visible {
  background: #282d36;
  outline: 0;
}

.share-status {
  min-height: 18px;
  padding: 6px 12px 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.share-status:empty {
  display: none;
}

.select-shell {
  position: relative;
  display: inline-block;
  width: 100%;
}

.select-arrow {
  position: absolute;
  top: 50%;
  right: 16px;
  display: inline-block;
  width: 16px;
  height: 16px;
  overflow: hidden;
  background-image: var(--dropdown-arrow-icon);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 16px 16px;
  font-size: 0;
  line-height: 1;
  pointer-events: none;
  transform: translateY(-50%) rotate(0deg);
  transform-origin: 50% 54%;
  transition: transform 180ms ease;
}

.select-shell.open .select-arrow {
  transform: translateY(-50%) rotate(180deg);
}

.community-finder {
  width: 100%;
  max-width: none;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 26, 32, 0.98);
  box-shadow: var(--shadow);
}

.community-finder-wrap {
  width: min(100%, 920px);
  overflow: visible;
}

.community-finder-table {
  width: 100%;
  min-width: 0;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.community-finder-table thead {
  position: sticky;
  top: 0;
  z-index: 8;
}

.community-finder-table th,
.community-finder-table td {
  padding: 10px 16px;
}

.community-finder-table th {
  position: sticky;
  top: 0;
  z-index: 9;
  background: var(--panel);
  vertical-align: middle;
}

.community-finder-table th:nth-child(1),
.community-finder-table td:nth-child(1) {
  width: 52%;
}

.community-finder-table th:nth-child(2),
.community-finder-table td:nth-child(2) {
  width: 24%;
  white-space: nowrap;
}

.community-finder-table th:nth-child(3),
.community-finder-table td:nth-child(3) {
  width: 24%;
  white-space: nowrap;
}

.community-finder-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.community-finder-heading .sort-button {
  align-self: stretch;
}

.community-finder-table th > .sort-button,
.community-finder-heading .sort-button {
  min-height: 34px;
  align-items: center;
}

.community-finder-heading .clearable-input {
  flex: 1 1 9rem;
  width: auto;
  min-width: 0;
}

.community-finder-heading input {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 0 10px;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1;
}

.community-finder-heading .clearable-input input {
  padding-right: 34px;
}

.community-finder-row {
  cursor: pointer;
}

.community-finder-row:hover,
.community-finder-row:focus {
  background: rgba(var(--primary-rgb), 0.07);
  outline: 0;
}

.community-finder-row.selected {
  background: var(--primary-soft);
}

.community-finder-empty td {
  color: var(--muted);
}

.community-finder-number {
  white-space: nowrap;
}

.community-finder-number .spinner {
  width: 0.95em;
  height: 0.95em;
  border-width: 2px;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 4vw, 4rem);
  line-height: 0.98;
  letter-spacing: 0;
  white-space: nowrap;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.05rem;
}

main {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: 0;
  padding: 0 clamp(12px, 2vw, 28px);
}

.control-band,
.ask-ai-section,
.panel,
.kpis article {
  background: rgba(23, 26, 32, 0.95);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.control-band {
  display: block;
  order: 1;
  margin-top: 18px;
  padding: 22px;
  border-radius: 8px;
}

.ask-ai-section {
  order: 2;
  margin-top: 14px;
  padding: 18px 22px;
  border-radius: 8px;
}

.panel-head p,
footer {
  color: var(--muted);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: var(--filter-control-gap);
}

.controls > label,
.controls > .filter-group,
.controls > .community-finder,
.community-control-row > label,
.community-control-row > .community-finder,
.community-control-row > .filter-group,
.community-control-row > button,
.community-control-row > .reset-search-row,
.more-filters-panel > label,
.more-filters-panel > .filter-group,
.reset-search-row > button {
  flex: 0 0 auto;
  max-width: 100%;
}

.controls > .control-field {
  width: var(--control-width);
}

.controls > .community-control-row,
.community-control-row > .reset-search-row {
  display: contents;
}

.controls > .more-filters-panel {
  display: flex;
  flex: 0 0 100%;
  flex-wrap: wrap;
  align-items: end;
  gap: var(--filter-control-gap);
}

.community-control-row > .community-select {
  margin-bottom: 11px;
}

.community-control-row > .more-filters-toggle {
  flex: 0 0 auto;
  width: var(--filter-action-width);
  height: 44px;
  margin-bottom: 11px;
  padding: 0 10px;
}

.controls > .community-finder,
.community-control-row > .community-finder {
  flex: 0 0 100%;
}

.controls > .more-filters-panel[hidden],
.community-control-row > .reset-search-row[hidden] {
  display: none;
}

.reset-search-button {
  width: var(--filter-action-width);
  min-width: var(--filter-action-width);
  height: 44px;
  margin-bottom: 11px;
  background: var(--field);
  color: var(--mint-dark);
  font-size: 1rem;
  font-weight: 400;
  padding: 0 10px;
  white-space: nowrap;
}

.ask-ai-field {
  position: relative;
  flex: 1 1 min(520px, 100%);
  min-width: min(100%, 280px);
  max-width: 900px;
}

.ask-ai-field input {
  width: 100%;
  padding: 0 54px 0 14px;
  color: var(--ink);
}

.ask-ai-button {
  position: absolute;
  top: 1px;
  right: 1px;
  display: inline-grid;
  place-items: center;
  width: 44px;
  min-width: 0;
  min-height: 42px;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0 999px 999px 0;
  background: #20242c;
  color: var(--mint-dark);
}

.ask-ai-button:hover,
.ask-ai-button:focus-visible {
  background: #282d36;
  outline: 0;
}

.ask-ai-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.ask-ai-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
  width: 100%;
}

.ask-ai-panel {
  display: grid;
  gap: 8px;
  width: 100%;
  max-width: none;
}

.ask-ai-panel .ask-ai-field {
  flex: 1 1 420px;
  width: min(100%, 900px);
  max-width: 900px;
}

.ask-ai-examples-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: max-content;
  min-height: 44px;
  padding: 0 12px;
  background: var(--field);
  color: var(--mint-dark);
  font-size: 0.92rem;
  font-weight: 400;
  white-space: nowrap;
}

.more-filters-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--field);
  color: var(--mint-dark);
  font-size: 1rem;
  font-weight: 400;
  white-space: nowrap;
}

.more-filters-toggle[aria-expanded="true"] .more-filters-arrow,
.ask-ai-examples-toggle[aria-expanded="true"] .more-filters-arrow {
  transform: rotate(180deg);
}

.ask-ai-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.ask-ai-examples[hidden] {
  display: none;
}

.ask-ai-examples button {
  width: auto;
  min-height: 34px;
  padding: 0 10px;
  background: rgba(154, 162, 174, 0.08);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 400;
  white-space: nowrap;
}

.ask-ai-reply {
  width: 100%;
  box-sizing: border-box;
  min-height: 20px;
  padding-left: 14px;
  color: var(--mint-dark);
  font-size: 0.92rem;
  line-height: 1.45;
}

.ask-ai-reply:empty {
  display: none;
}

.ask-ai-reply[data-state="error"] {
  color: var(--muted);
}

.more-filters-toggle:hover,
.more-filters-toggle:focus-visible,
.more-filters-toggle[aria-expanded="true"],
.ask-ai-examples-toggle:hover,
.ask-ai-examples-toggle:focus-visible,
.ask-ai-examples-toggle[aria-expanded="true"],
.reset-search-button:hover,
.reset-search-button:focus-visible,
.ask-ai-examples button:hover,
.ask-ai-examples button:focus-visible {
  background: #242934;
  outline: 0;
}

.more-filters-arrow {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  overflow: hidden;
  background-image: var(--dropdown-arrow-icon);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 16px 16px;
  font-size: 0;
  line-height: 1;
  transform: rotate(0deg);
  transform-origin: 50% 54%;
  transition: transform 180ms ease;
}

.more-filters-panel[hidden] {
  display: none;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.filter-label,
legend {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.filter-heading {
  position: relative;
  display: flex;
  flex: 0 0 100%;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.filter-heading .filter-label {
  margin-bottom: 0;
}

input,
select,
button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

input,
select {
  width: 100%;
  min-width: var(--control-width);
  padding: 0 12px;
  background: var(--field);
  color: var(--ink);
}

input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
  appearance: none;
  display: none;
}

.clearable-input {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
}

.clearable-input input {
  padding-right: 38px;
}

.input-clear {
  position: absolute;
  top: 50%;
  right: 8px;
  display: inline-grid;
  place-items: center;
  width: 26px;
  min-width: 0;
  height: 26px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 400;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%);
}

.clearable-input.has-value .input-clear {
  opacity: 1;
  pointer-events: auto;
}

.input-clear:hover,
.input-clear:focus-visible {
  background: rgba(154, 162, 174, 0.14);
  color: var(--ink);
  outline: 0;
}

#lookback,
#areaFilter {
  appearance: none;
  padding-right: 40px;
}

#textSearch {
  min-width: var(--control-width);
}

.control-field {
  width: var(--control-width);
  max-width: 100%;
}

.filter-group {
  max-width: 100%;
  padding: 10px;
  border: 1px solid rgba(154, 162, 174, 0.2);
  border-radius: 8px;
  background: rgba(154, 162, 174, 0.06);
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: var(--filter-toggle-gap);
}

.filter-group > .control-field {
  flex: 0 0 var(--control-width);
}

.date-group > .control-field,
.price-group > .control-field {
  width: var(--compact-control-width);
  flex-basis: var(--compact-control-width);
}

.date-group input,
.date-group select,
.price-group input,
.price-group select {
  min-width: var(--compact-control-width);
}

#lookback,
#dateFromFilter,
#dateToFilter,
#priceFromFilter,
#priceToFilter {
  height: 44px;
  min-height: 44px;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1;
}

#lookback,
#dateFromFilter,
#dateToFilter {
  padding-left: 10px;
}

#dateFromFilter,
#dateToFilter {
  padding-right: 10px;
}

#lookback {
  padding-right: 40px;
}

#priceFromFilter,
#priceToFilter {
  padding-left: 10px;
  padding-right: 38px;
}

.price-group > .switch-field {
  width: max-content;
  flex: 0 0 auto;
}

.switch-field {
  display: grid;
  align-self: end;
  align-content: end;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.switch-control {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 44px;
}

.switch-field input {
  position: absolute;
  width: 1px;
  min-width: 0;
  min-height: 0;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: relative;
  flex: 0 0 42px;
  width: 42px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #20242c;
  transition: background 160ms ease, border-color 160ms ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 160ms ease, background 160ms ease;
}

.switch-field input:checked + .switch-track,
.raw-title-toggle input:checked + .switch-track {
  border-color: var(--primary-focus);
  background: rgba(var(--primary-rgb), 0.24);
}

.switch-field input:checked + .switch-track::after {
  transform: translateX(18px);
  background: var(--amber);
}

.switch-field:focus-within .switch-track,
.raw-title-toggle:focus-within .switch-track {
  outline: 2px solid rgba(213, 217, 223, 0.28);
  outline-offset: 2px;
}

.toggle-group {
  display: grid;
  align-content: start;
  gap: var(--filter-toggle-gap);
}

.toggle-group .filter-label,
fieldset.filter-group legend {
  margin-bottom: 0;
}

.date-group,
.price-group,
.property-group,
.status-group,
.payment-group,
.segment-group,
.zoning-group {
  border-color: var(--primary-border);
  background: var(--primary-faint);
}

input[type="date"] {
  color-scheme: dark;
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: var(--filter-toggle-gap);
  max-width: 100%;
  overflow: visible;
}

.toggle {
  width: auto;
  min-width: max-content;
  min-height: 44px;
  padding: 0 10px;
  background: var(--field);
  color: var(--muted);
  white-space: nowrap;
}

.toggle.active {
  border-color: var(--coral);
  background: var(--primary-soft);
  color: var(--amber);
}

button {
  align-self: end;
  cursor: pointer;
  font-weight: 900;
}

.control-band label,
.control-band legend,
.control-band .filter-label,
.control-band button {
  font-weight: 400;
}

code {
  color: var(--mint-dark);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.kpis {
  order: 3;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 14px;
  margin: 18px 0;
}

.kpis article[hidden] {
  display: none;
}

.kpis article {
  min-width: 0;
  min-height: 112px;
  padding: 18px;
  border-radius: 8px;
}

.kpis article > span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.kpis strong {
  display: block;
  margin-top: 14px;
  min-width: 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-weight: 400;
  letter-spacing: 0;
}

.money {
  display: inline-flex;
  align-items: center;
  gap: 0.18em;
  line-height: 1;
  white-space: nowrap;
}

.dirham-mark {
  width: auto;
  height: 1em;
  flex: 0 0 auto;
  fill: currentColor;
  transform: translateY(0.03em);
}

.kpis .dirham-mark {
  height: 0.82em;
  transform: translateY(0.04em);
}

.spinner {
  display: inline-block;
  width: 1.05em;
  height: 1.05em;
  border: 3px solid rgba(213, 217, 223, 0.16);
  border-top-color: var(--coral);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
  vertical-align: -0.14em;
}

.table-loading-cell {
  padding: 40px 16px;
  text-align: center;
  vertical-align: middle;
}

.table-loading-cell .spinner {
  width: 1.8rem;
  height: 1.8rem;
  border-width: 3px;
}

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

.table-section {
  margin-top: 18px;
}

.community-select {
  align-self: stretch;
  width: calc(var(--compact-control-width) + 22px);
  padding: 10px;
  border: 1px solid rgba(154, 162, 174, 0.2);
  border-radius: 8px;
  background: rgba(154, 162, 174, 0.06);
  font-weight: 400;
}

.community-control-row > .community-select {
  align-self: end;
  width: max-content;
  max-width: 100%;
  flex-basis: auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.community-select select {
  min-width: 0;
}

.community-select-shell {
  display: block;
  width: max-content;
  max-width: 100%;
}

.community-select-trigger {
  width: max-content;
  max-width: min(100%, calc(100vw - 48px));
  min-width: var(--control-width);
  min-height: 44px;
  padding: 0 40px 0 12px;
  background: var(--field);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 400;
  text-align: left;
  white-space: nowrap;
}

.community-select-trigger:hover,
.community-select-trigger:focus-visible,
.community-select-shell.open .community-select-trigger {
  background: #242934;
}

.community-finder-chips {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.table-section {
  order: 4;
  width: 100%;
  min-width: max(100%, var(--records-table-min-width, 1138px));
  max-width: none;
}

.panel {
  border-radius: 8px;
  overflow: visible;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.panel-foot {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.panel-head p {
  margin-bottom: 0;
  white-space: nowrap;
}

.table-wrap {
  width: 100%;
  min-width: 100%;
  max-width: none;
  overflow-x: visible;
  overflow-y: visible;
}

.table-panel {
  width: 100%;
  min-width: 100%;
  max-width: none;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  padding: 0;
  border-bottom: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.pagination:empty {
  display: none;
}

.sale-rent-field[hidden] {
  display: none;
}

.pagination button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-height: 32px;
  padding: 0;
  background: var(--field);
  color: var(--mint-dark);
}

.page-size-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 8px;
  white-space: nowrap;
}

.page-size-label {
  color: var(--muted);
}

.pagination .pagination-size-button {
  width: auto;
  min-width: 44px;
  padding: 0 10px;
}

.pagination-size-button.active {
  border-color: var(--coral);
  background: var(--primary-soft);
  color: var(--amber);
}

.pagination-summary {
  display: inline-block;
  width: 15ch;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pagination-icon svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.pagination button:disabled {
  cursor: default;
  opacity: 0.45;
}

.column-menu-header {
  width: 56px;
  min-width: 56px;
  text-align: right;
  white-space: nowrap;
}

.column-menu {
  position: relative;
  display: inline-block;
}

.column-menu-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-height: 32px;
  padding: 0;
  background: var(--field);
  color: var(--mint-dark);
}

.column-menu-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.column-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  display: grid;
  gap: 2px;
  min-width: 190px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #171a20;
  box-shadow: var(--shadow);
  text-align: left;
  text-transform: none;
}

.column-menu-option {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 0 8px;
  border-radius: 6px;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 400;
  white-space: nowrap;
}

.column-menu-option:hover {
  background: rgba(154, 162, 174, 0.1);
}

.column-menu-option input {
  width: 15px;
  min-width: 0;
  height: 15px;
  min-height: 0;
  margin: 0;
  padding: 0;
}

.column-menu-spacer {
  width: 1%;
  padding: 0 16px;
}

.pin-column {
  width: 56px;
  min-width: 56px;
  text-align: center;
}

.map-pin-link,
.map-pin-empty {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--mint-dark);
  line-height: 1;
}

.map-pin-link {
  border-radius: 50%;
  text-decoration: none;
}

.map-pin-link:hover,
.map-pin-link:focus-visible {
  background: rgba(var(--primary-rgb), 0.14);
  color: var(--mint);
  outline: 0;
}

.map-pin-link svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.map-pin-empty {
  color: rgba(231, 236, 243, 0.28);
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
}

#recordsTable {
  --table-cell-padding: 10px;
  width: 100%;
  max-width: none;
  min-width: 100%;
  table-layout: auto;
}

#recordsTable th,
#recordsTable td {
  padding-right: var(--table-cell-padding);
  padding-left: var(--table-cell-padding);
}

#recordsTable td {
  overflow-wrap: normal;
  white-space: nowrap;
}

#recordsTable th {
  overflow: visible;
  overflow-wrap: normal;
  white-space: nowrap;
}

#recordsTable .column-menu-header {
  padding-right: 24px;
  padding-left: 10px;
  overflow: visible;
}

#recordsTable th:first-child,
#recordsTable td:first-child {
  padding-left: var(--table-cell-padding);
}

#recordsTable th:last-child,
#recordsTable td:last-child {
  padding-right: var(--table-cell-padding);
}

#recordsTable th.column-menu-header:last-child {
  padding-right: 24px;
  padding-left: 10px;
}

thead {
  position: sticky;
  top: 0;
  z-index: 3;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--panel);
  color: var(--amber);
  font-size: 1rem;
  font-weight: 400;
  text-transform: none;
}

th[aria-sort="ascending"],
th[aria-sort="descending"],
th[aria-sort="ascending"] .sort-button,
th[aria-sort="descending"] .sort-button,
#recordsTable th.sorted-column,
#recordsTable th.sorted-column .sort-button,
.sort-button.active {
  color: var(--lime);
  font-weight: 700;
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  max-width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-weight: 400;
  text-align: left;
  text-transform: none;
  white-space: nowrap;
}

.sort-button::after {
  content: "";
  flex: 0 0 0.45rem;
  width: 0.45rem;
}

.sort-button.active.asc::after {
  content: "↑";
}

.sort-button.active.desc::after {
  content: "↓";
}

.sort-button:hover,
.sort-button:focus {
  color: var(--amber);
  outline: 0;
}

.sort-button.active:hover,
.sort-button.active:focus {
  color: var(--lime);
}

td {
  font-size: 0.9rem;
  white-space: nowrap;
}

.record-row {
  cursor: pointer;
}

.record-row:hover,
.record-row:focus,
.record-row[aria-expanded="true"] {
  background: rgba(var(--primary-rgb), 0.07);
  outline: 0;
}

td[data-label="#"] {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.community-cell {
  display: grid;
  gap: 3px;
  line-height: 1.25;
}

.community-cell-main,
.community-cell-sub {
  display: block;
}

.community-cell-sub {
  color: var(--muted);
}

.area-size {
  font-variant-numeric: tabular-nums;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 8px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.78rem;
}

.tag.sale {
  background: #080;
}

.tag.rent {
  background: #00A;
}

.area-list {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 10px;
  width: max-content;
  min-width: 0;
  padding: 0;
  overflow: visible;
  transform: translateX(0);
  will-change: transform;
}

.community-chip-viewport {
  min-width: 0;
  overflow: hidden;
  cursor: ew-resize;
}

.raw-detail {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.raw-expander-row {
  background: rgba(154, 162, 174, 0.045);
}

.raw-expander-cell {
  padding: 0;
  border-bottom: 1px solid var(--line);
}

.raw-loading {
  display: flex;
  align-items: center;
  padding: 12px;
}

.compact {
  width: auto;
  min-height: 36px;
  justify-self: start;
  padding: 0 12px;
}

.raw-detail h3 {
  margin: 4px 0 0;
  font-size: 0.95rem;
}

.raw-source-layout {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.raw-list {
  display: inline-grid;
  grid-template-columns: fit-content(22rem) fit-content(52rem);
  flex: 0 1 auto;
  justify-self: start;
  gap: 0;
  margin: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--field);
}

.raw-list dt,
.raw-list dd {
  min-width: 0;
  margin: 0;
  padding: 3px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.raw-list dt {
  max-width: min(34vw, 22rem);
}

.raw-list dd {
  max-width: min(58vw, 52rem);
}

.raw-list dt {
  background: var(--soft);
  color: var(--amber);
  font-weight: 400;
}

.raw-list dd {
  color: var(--ink);
}

.raw-extra-list[hidden] {
  display: none;
}

.raw-list dt:last-of-type,
.raw-list dd:last-of-type {
  border-bottom: 0;
}

.raw-actions {
  display: grid;
  flex: 0 0 auto;
  align-content: start;
  justify-items: start;
  gap: 8px;
  margin: 0 32px;
  min-width: max-content;
}

.raw-toggle {
  display: inline-grid;
  grid-template-columns: 38px auto 16px;
  align-items: center;
  gap: 8px;
  width: max-content;
  min-height: 30px;
  justify-self: start;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--mint-dark);
  font-size: 0.92rem;
  font-weight: 400;
  text-align: left;
}

.raw-toggle-arrow {
  width: 16px;
  height: 16px;
  background: var(--dropdown-arrow-icon) center / 16px 16px no-repeat;
  transform: rotate(-90deg);
  transition: transform 160ms ease;
}

.raw-toggle[aria-expanded="true"] .raw-toggle-arrow {
  transform: rotate(90deg);
}

.raw-toggle:hover,
.raw-toggle:focus-visible {
  color: var(--amber);
  outline: 0;
}

.raw-toggle-spacer {
  width: 38px;
  height: 1px;
}

.raw-title-toggle {
  position: relative;
  display: inline-grid;
  grid-template-columns: 38px auto;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 400;
  white-space: nowrap;
}

.raw-title-toggle .switch-control {
  width: 38px;
  min-height: 30px;
}

.raw-title-toggle input {
  position: absolute;
  width: 1px;
  min-width: 0;
  min-height: 0;
  opacity: 0;
  pointer-events: none;
}

.raw-title-toggle .switch-track {
  flex-basis: 38px;
  width: 38px;
  height: 22px;
}

.raw-title-toggle .switch-track::after {
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
}

.raw-title-toggle input:checked + .switch-track::after {
  transform: translateX(16px);
  background: var(--amber);
}

.empty-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.area-item {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  flex: 0 0 auto;
  gap: 7px 14px;
  min-width: 210px;
  max-width: 310px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  cursor: pointer;
  transition: border-color 140ms ease;
}

.area-item:hover,
.area-item:focus {
  border-color: var(--coral);
  outline: 0;
}

.area-item.selected {
  border-color: var(--coral);
  background: var(--primary-faint);
}

.area-item strong {
  min-width: 0;
  overflow-wrap: anywhere;
  grid-column: 1 / -1;
}

.area-item span {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1;
}

.bar {
  grid-column: 1 / -1;
  height: 7px;
  border-radius: 999px;
  background: #252932;
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--mint), var(--coral));
}

footer {
  width: 100%;
  margin: 34px 0;
  padding: 0 clamp(12px, 2vw, 28px);
  font-size: 0.9rem;
}

footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
}

@media (max-width: 900px) {
  .topbar,
  .control-band,
  .table-section {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
    align-items: start;
    gap: 14px;
  }

  .brand-logo {
    order: 1;
  }

  .topbar-actions {
    order: 2;
    justify-self: start;
  }

  .theme-panel,
  .share-panel {
    right: auto;
    left: 0;
  }

  .top-search-area {
    order: 3;
    justify-self: stretch;
    max-width: none;
  }

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

  .area-list {
    padding: 0;
  }
}

@media (max-width: 620px) {
  main,
  footer {
    width: 100%;
  }

  main {
    padding-inline: 4px;
  }

  .topbar {
    padding: 24px 12px 16px;
  }

  .top-search-button {
    flex-basis: 54px;
    width: 54px;
  }

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

  .kpis {
    gap: 2px;
    margin: 12px 0;
  }

  .kpis article {
    min-height: 64px;
    padding: 6px 0;
    border-radius: 6px;
  }

  .kpis article > span {
    line-height: 1.08;
  }

  .kpis strong {
    margin-top: 7px;
    line-height: 1;
  }

  .kpis .money {
    gap: 0.08em;
  }

  .control-band,
  .ask-ai-section {
    padding: 16px;
  }

  .community-select {
    width: 100%;
  }

  .panel-head {
    display: grid;
    gap: 4px;
  }

  .panel-head p {
    white-space: normal;
  }
}
