:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --ink: #22221f;
  --muted: #706b62;
  --line: #ded8cc;
  --accent: #19715f;
  --danger: #9c3b33;
  --shadow: 0 18px 45px rgba(33, 30, 24, 0.18);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 9px 13px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  filter: brightness(0.94);
}

.app-shell {
  min-height: 100vh;
}

.auth-view {
  display: grid;
  align-content: center;
  gap: 28px;
  width: min(720px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 64px 0;
}

.app-view {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
}

.map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 100vh;
  z-index: 0;
}

.brand p {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2.2rem, 7vw, 4.8rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.topbar,
.account,
.add-row,
.section-header,
.panel-actions,
.modal-header,
.modal-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 30px rgba(33, 30, 24, 0.12);
}

.brandmark {
  color: var(--accent);
  font-size: 1rem;
  letter-spacing: 0;
}

.account {
  position: relative;
  justify-content: flex-end;
}

.account-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0;
  background: #fff;
  color: var(--accent);
  overflow: hidden;
}

.account-button img,
#user-initials {
  width: 100%;
  height: 100%;
}

.account-button img {
  object-fit: cover;
}

#user-initials {
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 900;
}

.account-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  min-width: 160px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.account-dropdown button,
.columns-menu label,
.property-card button,
.modal-actions button:first-child,
.icon-button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}

.account-dropdown button {
  justify-content: flex-start;
  min-height: 36px;
  text-align: left;
}

.property-panel {
  position: absolute;
  z-index: 11;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.property-form {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 10px;
  background: var(--surface);
}

label,
legend {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.add-row input {
  flex: 1;
  min-width: 0;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
  accent-color: var(--accent);
}

.property-panel {
  display: flex;
  flex-direction: column;
  left: 12px;
  top: 70px;
  bottom: 12px;
  width: clamp(360px, 34vw, 560px);
  max-width: calc(100vw - 24px);
  overflow: hidden;
  padding: 0;
}

.section-header {
  justify-content: space-between;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0;
  padding: 9px 10px;
}

.section-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

#columns-button {
  display: grid;
  place-items: center;
  width: 32px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0;
  background: #fff;
  color: var(--ink);
}

#columns-button svg {
  width: 16px;
  height: 16px;
  fill: currentcolor;
}

.columns-menu {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 8px 10px;
}

.columns-menu legend {
  padding: 0 4px;
}

.columns-menu label {
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 9px;
}

.property-list {
  display: grid;
  align-content: start;
  flex: 1 1 auto;
  gap: 0;
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

.property-card {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(78px, 0.55fr) minmax(70px, 0.45fr) minmax(62px, 0.38fr) minmax(72px, 0.4fr) 34px;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 0;
  border-bottom: 1px solid rgba(222, 216, 204, 0.7);
  border-radius: 0;
  padding: 5px 10px;
  background: transparent;
  font-size: 0.84rem;
}

.property-card-header {
  position: sticky;
  top: 0;
  z-index: 1;
  min-height: 32px;
  background: #fff;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.property-card[data-unmapped="true"] {
  background: rgba(251, 250, 247, 0.72);
}

.property-address {
  color: var(--accent);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.property-address-button {
  min-height: 24px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent);
  text-align: left;
}

.property-card[data-unmapped="true"] .property-address,
.property-cell {
  color: var(--muted);
}

.property-cell {
  font-weight: 700;
}

.property-price {
  color: var(--ink);
}

.property-card button {
  min-height: 26px;
  padding: 0;
  color: var(--danger);
}

.property-card .property-address-button {
  color: var(--accent);
}

.property-action-header {
  min-width: 34px;
}

.trash-button {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
}

.trash-button svg {
  width: 15px;
  height: 15px;
  fill: currentcolor;
}

.property-panel-footer {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  padding: 10px;
  background: var(--surface);
}

.add-property-button {
  width: 100%;
  background: var(--accent);
}

.workplace-marker-icon {
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 8px 18px rgba(33, 30, 24, 0.28);
  color: #fff;
}

.workplace-marker-icon svg {
  width: 18px;
  height: 18px;
  fill: currentcolor;
}

.empty-state,
.helper {
  color: var(--muted);
}

.empty-state {
  margin-bottom: 0;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.58);
}

.modal-layer {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(34, 34, 31, 0.34);
}

.profile-modal,
.property-detail-modal {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.profile-modal {
  width: min(440px, 100%);
}

.property-detail-modal {
  width: min(1080px, 100%);
  max-height: min(88vh, 860px);
  overflow: auto;
}

.modal-header {
  justify-content: space-between;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  min-height: 36px;
  padding: 0;
}

.icon-button svg {
  width: 17px;
  height: 17px;
  fill: currentcolor;
}

.modal-actions {
  justify-content: flex-end;
}

.address-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
}

.address-search .icon-button {
  width: 42px;
  min-height: 44px;
  background: var(--accent);
  color: #fff;
}

.address-results {
  display: grid;
  gap: 6px;
}

.address-result {
  display: grid;
  gap: 2px;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: #fbfaf7;
  color: var(--ink);
  text-align: left;
}

.address-result strong {
  font-size: 0.9rem;
}

.address-result span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.detail-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.property-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 14px;
}

.property-detail-main,
.property-detail-side,
.detail-section,
.document-upload-form {
  display: grid;
  gap: 10px;
  align-content: start;
}

.property-detail-side {
  border-left: 1px solid var(--line);
  padding-left: 14px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.detail-stat,
.fact-row,
.document-row {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfaf7;
}

.detail-stat {
  display: grid;
  gap: 3px;
  min-height: 62px;
  padding: 8px;
}

.detail-stat span,
.fact-category,
.document-meta {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-stat strong,
.document-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.94rem;
}

.detail-section h3 {
  margin: 4px 0 0;
  font-size: 0.98rem;
}

.fact-list,
.document-list {
  display: grid;
  gap: 6px;
}

.fact-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.5fr) minmax(130px, 0.6fr) minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 7px 8px;
  font-size: 0.86rem;
}

.fact-label {
  color: var(--ink);
  font-weight: 900;
}

.fact-value {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.document-row {
  display: grid;
  gap: 4px;
  padding: 8px;
}

.external-link {
  display: grid;
  place-items: center;
  min-height: 40px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
  text-decoration: none;
}

.document-upload-form input {
  min-height: 40px;
  padding: 8px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 700px) {
  .topbar {
    padding: 8px 12px;
  }

  .property-panel {
    max-height: 50vh;
    top: auto;
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
  }

  .add-row {
    align-items: stretch;
    flex-direction: column;
  }

  .property-detail-layout,
  .detail-grid,
  .fact-row {
    grid-template-columns: 1fr;
  }

  .property-detail-side {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-top: 12px;
    padding-left: 0;
  }
}
