:root {
  --ink: #15242b;
  --petrol: #172f3b;
  --petrol-2: #244a5a;
  --acid: #d8ff3e;
  --paper: #f4efe6;
  --surface: #fffdf9;
  --muted: #66737a;
  --line: #dcd8cf;
  --danger: #9d302c;
  --shadow: 0 24px 70px rgba(21, 36, 43, .12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--paper); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: .75rem;
  left: .75rem;
  padding: .75rem 1rem;
  transform: translateY(-160%);
  background: white;
  color: var(--ink);
  border-radius: .4rem;
}
.skip-link:focus { transform: 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; }

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(22rem, 42%) 1fr;
  background: var(--surface);
}
.login-panel {
  align-self: center;
  width: min(31rem, calc(100% - 4rem));
  margin-inline: auto;
  padding-block: 4rem;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 3.25rem;
  aspect-ratio: 1;
  margin-bottom: 2rem;
  border-radius: .8rem;
  color: var(--petrol);
  background: var(--acid);
  font-weight: 900;
  font-size: 1.35rem;
}
.brand-mark-small { width: 2.5rem; margin: 0; border-radius: .65rem; font-size: 1rem; }
.eyebrow { margin: 0 0 .55rem; color: var(--petrol-2); font-size: .72rem; font-weight: 760; letter-spacing: .13em; text-transform: uppercase; }
.login-panel h1 { max-width: 12ch; margin: 0; font-size: clamp(2.25rem, 4vw, 4.2rem); line-height: .98; letter-spacing: -.055em; }
.login-copy { max-width: 34rem; margin: 1.4rem 0 2.25rem; color: var(--muted); font-size: 1rem; line-height: 1.6; }
.login-art {
  position: relative;
  display: grid;
  align-items: end;
  overflow: hidden;
  min-height: 100vh;
  padding: clamp(2rem, 6vw, 6rem);
  color: white;
  background:
    linear-gradient(145deg, rgba(12, 28, 35, .15), rgba(12, 28, 35, .92)),
    radial-gradient(circle at 28% 20%, #8d7d69 0, transparent 36%),
    linear-gradient(135deg, #526a70, #172f3b 65%);
}
.login-art::before {
  content: "";
  position: absolute;
  inset: 9% 10% 16% 22%;
  border: 1px solid rgba(216, 255, 62, .45);
  border-radius: 48% 52% 12% 88% / 44% 20% 80% 56%;
  transform: rotate(-9deg);
}
.login-art__line { position: absolute; top: 10%; right: 10%; width: 6rem; height: .55rem; background: var(--acid); transform: rotate(-8deg); }
.login-art p { position: relative; margin: 0; font-size: clamp(2.3rem, 5vw, 6.5rem); line-height: .88; letter-spacing: -.065em; }
.login-art strong { color: var(--acid); font-weight: 760; }

.stack { display: grid; gap: 1.15rem; }
label { display: grid; gap: .48rem; color: #33464f; font-size: .83rem; font-weight: 680; }
input, select, textarea {
  width: 100%;
  min-height: 2.85rem;
  padding: .72rem .85rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: .5rem;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--petrol-2); box-shadow: 0 0 0 3px rgba(36, 74, 90, .12); }
input[type="checkbox"] { width: 1.15rem; min-height: 1.15rem; accent-color: var(--petrol); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.8rem;
  padding: .7rem 1.1rem;
  border: 1px solid transparent;
  border-radius: .5rem;
  font-weight: 760;
  font-size: .86rem;
  text-decoration: none;
  transition: transform .18s ease, background-color .18s ease, border-color .18s ease;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .58; transform: none; }
.button-primary { color: #fff; background: var(--petrol); }
.button-primary:hover { background: var(--petrol-2); }
.button-secondary { color: var(--petrol); background: var(--acid); }
.button-ghost { color: var(--petrol); background: transparent; border-color: var(--line); }
.text-button { padding: 0; color: rgba(255, 255, 255, .72); background: transparent; border: 0; text-align: left; text-decoration: underline; text-underline-offset: .25rem; }
.icon-button { display: grid; place-items: center; width: 2.6rem; aspect-ratio: 1; color: inherit; background: transparent; border: 1px solid var(--line); border-radius: .5rem; font-size: 1.25rem; }
.form-error { margin: 0; color: var(--danger); font-size: .85rem; line-height: 1.45; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 17rem minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 1.5rem;
  color: white;
  background: var(--petrol);
}
.sidebar-brand { display: flex; align-items: center; gap: .75rem; margin-bottom: 3.5rem; color: white; text-decoration: none; }
.sidebar-brand strong { display: block; font-size: .92rem; letter-spacing: .13em; }
.sidebar-brand small { display: block; margin-top: .16rem; color: rgba(255,255,255,.54); font-size: .72rem; }
.sidebar nav { display: grid; gap: .45rem; }
.nav-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  min-height: 2.8rem;
  padding: .65rem .75rem;
  color: rgba(255,255,255,.68);
  background: transparent;
  border: 0;
  border-radius: .55rem;
  text-align: left;
}
.nav-item:hover, .nav-item.is-active { color: white; background: rgba(255,255,255,.09); }
.nav-item.is-active { box-shadow: inset 3px 0 var(--acid); }
.badge { margin-left: auto; min-width: 1.45rem; padding: .18rem .42rem; border-radius: 999px; color: var(--petrol); background: var(--acid); font-size: .72rem; text-align: center; }
.sidebar-footer { margin-top: auto; padding-top: 1.5rem; border-top: 1px solid rgba(255,255,255,.14); }
.sidebar-footer p { margin: 0 0 .5rem; font-size: .86rem; font-weight: 720; }

.workspace { min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 6.8rem;
  padding: 1.2rem clamp(1.2rem, 4vw, 3.5rem);
  background: rgba(244, 239, 230, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.topbar h1 { margin: 0; font-size: 1.65rem; letter-spacing: -.035em; }
.topbar .button { margin-left: auto; }
.menu-button { display: none; }
.content { padding: clamp(1.5rem, 4vw, 3.5rem); }

.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 2.6rem; }
.metrics article { position: relative; overflow: hidden; padding: 1.4rem; background: var(--surface); border: 1px solid var(--line); border-radius: .75rem; }
.metrics article::after { content: ""; position: absolute; right: -1rem; bottom: -1.7rem; width: 5rem; aspect-ratio: 1; border: 1px solid rgba(36,74,90,.14); border-radius: 50%; }
.metrics span { display: block; font-size: clamp(2rem, 4vw, 3rem); font-weight: 790; line-height: 1; letter-spacing: -.06em; }
.metrics p { margin: .65rem 0 0; color: var(--muted); font-size: .84rem; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.15rem; }
.section-heading h2, .section-heading h3 { margin: 0; letter-spacing: -.035em; }
.section-heading h2 { font-size: 1.5rem; }
.section-heading p { margin: .35rem 0 0; color: var(--muted); font-size: .88rem; }
.section-heading.compact { align-items: center; margin-bottom: .8rem; }

.table-card { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: .75rem; box-shadow: 0 12px 35px rgba(21,36,43,.04); }
.table-scroll { position: relative; overflow-x: auto; }
.contact-cell a { color: var(--petrol-2); text-decoration-color: rgba(36,74,90,.35); text-underline-offset: 2px; }
.contact-cell a:hover, .contact-cell a:focus-visible { color: var(--petrol); text-decoration-color: currentColor; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 1rem 1.15rem; border-bottom: 1px solid #ebe7df; text-align: left; vertical-align: middle; }
th { color: #65747b; background: #f8f5ef; font-size: .72rem; font-weight: 760; letter-spacing: .08em; text-transform: uppercase; }
td { font-size: .88rem; }
tbody tr:last-child td { border-bottom: 0; }
.property-cell { display: flex; align-items: center; gap: .8rem; min-width: 14rem; }
.property-thumb { display: grid; place-items: center; width: 3rem; aspect-ratio: 1; flex: 0 0 auto; overflow: hidden; border-radius: .45rem; color: var(--petrol); background: #e9e4da; font-weight: 800; }
.property-thumb img { width: 100%; height: 100%; object-fit: cover; }
.property-cell strong, .contact-cell strong { display: block; }
.property-cell small, .contact-cell small { display: block; margin-top: .2rem; color: var(--muted); }
.status-pill { display: inline-flex; align-items: center; padding: .3rem .55rem; border-radius: 999px; color: var(--petrol); background: #e5edf0; font-size: .72rem; font-weight: 740; text-transform: capitalize; }
.status-pill.published { background: #e7f2ce; color: #3d5912; }
.row-actions { display: flex; justify-content: flex-end; gap: .35rem; white-space: nowrap; }
.row-button { padding: .42rem .6rem; color: var(--petrol); background: transparent; border: 1px solid var(--line); border-radius: .4rem; font-size: .78rem; }
.row-button.danger { color: var(--danger); }
.lead-status { min-width: 9rem; min-height: 2.35rem; padding-block: .42rem; }
.empty-state { display: grid; justify-items: center; padding: 4rem 1rem; text-align: center; }
.empty-state > span { display: grid; place-items: center; width: 3.2rem; aspect-ratio: 1; margin-bottom: 1rem; border-radius: 50%; color: var(--petrol); background: var(--acid); font-size: 1.5rem; }
.empty-state h3 { margin: 0; }
.empty-state p { max-width: 31rem; margin: .55rem 0 0; color: var(--muted); }

.editor-dialog { width: min(58rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); padding: 0; overflow: hidden; border: 0; border-radius: .85rem; box-shadow: var(--shadow); }
.editor-dialog::backdrop { background: rgba(10, 20, 25, .66); backdrop-filter: blur(3px); }
.editor { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; max-height: calc(100vh - 2rem); background: var(--surface); }
.editor-header, .editor-footer { display: flex; align-items: center; gap: .8rem; padding: 1.15rem 1.35rem; border-color: var(--line); }
.editor-header { justify-content: space-between; border-bottom: 1px solid var(--line); }
.editor-header h2 { margin: 0; font-size: 1.45rem; letter-spacing: -.035em; }
.editor-body { overflow-y: auto; padding: 1.35rem; }
.editor-footer { justify-content: flex-end; border-top: 1px solid var(--line); }
.editor-footer .form-error { margin-right: auto; }
.form-section { padding: 1.25rem; background: #fbf8f2; border: 1px solid #e7e1d6; border-radius: .7rem; }
.form-section + .form-section { margin-top: 1rem; }
.form-section > h3 { margin: 0 0 1rem; font-size: 1rem; }
.form-grid { display: grid; gap: 1rem; }
.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.four-columns { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-4 { grid-column: span 4; }
.switch-row { display: flex; align-items: center; gap: .65rem; min-height: 2.8rem; padding: .7rem .8rem; background: #fff; border: 1px solid var(--line); border-radius: .5rem; }
.image-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .65rem; margin-bottom: 1rem; }
.image-card { position: relative; overflow: hidden; aspect-ratio: 4 / 3; border-radius: .55rem; background: #e5e1d8; }
.image-card img { width: 100%; height: 100%; object-fit: cover; }
.image-card button { position: absolute; top: .4rem; right: .4rem; width: 2rem; aspect-ratio: 1; color: white; background: rgba(12,25,31,.82); border: 0; border-radius: 50%; }
.upload-row { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: .75rem; }

.toast { position: fixed; z-index: 80; right: 1.2rem; bottom: 1.2rem; max-width: min(24rem, calc(100vw - 2.4rem)); padding: .85rem 1rem; color: white; background: var(--petrol); border-radius: .55rem; box-shadow: var(--shadow); font-size: .88rem; }
.toast.is-error { background: var(--danger); }

@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(18rem, 86vw); transform: translateX(-105%); transition: transform .22s ease; box-shadow: var(--shadow); }
  .app-shell.menu-open .sidebar { transform: none; }
  .menu-button { display: grid; }
  .topbar .button { display: none; }
  .two-columns, .four-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-4 { grid-column: span 2; }
  .image-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .upload-row { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .login-panel { width: min(100% - 2rem, 31rem); padding-block: 2rem; }
  .login-panel h1 { font-size: 2.35rem; }
  .metrics { grid-template-columns: 1fr; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .section-heading .button { width: 100%; }
  .two-columns, .four-columns { grid-template-columns: 1fr; }
  .span-2, .span-4 { grid-column: auto; }
  .editor-dialog { width: 100vw; max-width: none; height: 100dvh; max-height: none; border-radius: 0; }
  .editor { max-height: 100dvh; }
  .editor-footer { flex-wrap: wrap; }
  .editor-footer .form-error { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
.field-hint { margin: -.35rem 0 1rem; color: var(--muted); font-size: .84rem; }
