/* ============================================================
   Conexão Imobiliária — design system
   Elegante, bonito, atraente e totalmente funcional.
   ============================================================ */
:root {
  --bg: #f5f7f8;
  --bg-soft: #eef1f4;
  --card: #ffffff;
  --ink: #14202e;
  --ink-soft: #33414f;
  --muted: #64748b;
  --line: #e5eaf0;
  --line-strong: #d3dbe4;

  --brand: #0f766e;      /* esmeralda profunda */
  --brand-2: #0fb5a3;    /* teal vivo */
  --brand-ink: #0a5852;
  --brand-tint: #e7f5f2;
  --accent: #e0a43b;     /* dourado */
  --accent-ink: #8a5a10;
  --accent-tint: #fbf1dc;
  --danger: #d64545;
  --danger-tint: #fdecec;
  --success: #12a37a;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(16,32,46,.05), 0 1px 3px rgba(16,32,46,.04);
  --shadow: 0 4px 16px rgba(16,32,46,.07);
  --shadow-lg: 0 18px 44px rgba(16,32,46,.16);
  --grad: linear-gradient(135deg, var(--brand), var(--brand-2));
  --ring: 0 0 0 3px rgba(15,181,163,.28);
}

:root:not([data-theme="light"]) {
  @media (prefers-color-scheme: dark) {
    --bg: #0d141d;
    --bg-soft: #131c27;
    --card: #16202c;
    --ink: #e9eef4;
    --ink-soft: #c2ccd8;
    --muted: #92a2b4;
    --line: #243140;
    --line-strong: #33465a;
    --brand: #17a394;
    --brand-2: #2dd4bf;
    --brand-ink: #7fe6d8;
    --brand-tint: #10312e;
    --accent: #e6b155;
    --accent-ink: #f0cd8f;
    --accent-tint: #322616;
    --danger: #f0736f;
    --danger-tint: #3a1f1f;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow: 0 6px 20px rgba(0,0,0,.45);
    --shadow-lg: 0 20px 50px rgba(0,0,0,.6);
    --ring: 0 0 0 3px rgba(45,212,191,.32);
  }
}
:root[data-theme="dark"] {
  --bg: #0d141d; --bg-soft: #131c27; --card: #16202c; --ink: #e9eef4; --ink-soft: #c2ccd8;
  --muted: #92a2b4; --line: #243140; --line-strong: #33465a; --brand: #17a394; --brand-2: #2dd4bf;
  --brand-ink: #7fe6d8; --brand-tint: #10312e; --accent: #e6b155; --accent-ink: #f0cd8f;
  --accent-tint: #322616; --danger: #f0736f; --danger-tint: #3a1f1f;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 6px 20px rgba(0,0,0,.45);
  --shadow-lg: 0 20px 50px rgba(0,0,0,.6); --ring: 0 0 0 3px rgba(45,212,191,.32);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { line-height: 1.18; letter-spacing: -.01em; margin: 0 0 .4em; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-2); }
img { max-width: 100%; display: block; }
.muted { color: var(--muted); font-size: .9em; }
.hidden { display: none !important; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
::selection { background: var(--brand-2); color: #fff; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 12px clamp(16px, 4vw, 28px);
  background: color-mix(in srgb, var(--card) 86%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 11px; cursor: pointer; }
.brand strong { font-size: 1.02rem; letter-spacing: -.02em; }
.brand small { display: block; color: var(--muted); font-size: .7rem; font-weight: 500; }
.logo {
  width: 40px; height: 40px; border-radius: 12px; color: #fff; font-weight: 800; font-size: .95rem;
  display: grid; place-items: center; background: var(--grad); box-shadow: 0 4px 12px rgba(15,118,110,.35);
}
.mainnav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.mainnav a {
  padding: 9px 14px; border-radius: 10px; color: var(--ink-soft); font-weight: 600; font-size: .9rem;
  transition: background .15s, color .15s;
}
.mainnav a:hover { background: var(--bg-soft); color: var(--ink); }
.mainnav a.active { background: var(--brand-tint); color: var(--brand-ink); }

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid var(--line-strong); background: var(--card); color: var(--ink);
  padding: 10px 17px; border-radius: 11px; font-weight: 700; cursor: pointer; font-size: .9rem;
  font-family: inherit; transition: transform .1s, box-shadow .15s, border-color .15s, background .15s;
  display: inline-flex; align-items: center; gap: 7px; line-height: 1;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(15,118,110,.28); }
.btn-primary:hover { color: #fff; filter: brightness(1.05); box-shadow: 0 8px 22px rgba(15,118,110,.36); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--bg-soft); }
.btn-accent { background: var(--accent); color: #3a2a05; border-color: transparent; }
.btn-danger { color: var(--danger); border-color: var(--line-strong); }
.btn-danger:hover { border-color: var(--danger); background: var(--danger-tint); }
.btn-sm { padding: 6px 11px; font-size: .8rem; border-radius: 9px; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Layout ---------- */
main { max-width: 1160px; margin: 0 auto; padding: clamp(16px, 3vw, 28px); }
.view { display: none; }
.view.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 30px 0 14px; }
.section-head:first-child { margin-top: 6px; }
.section-head h2, .section-head h3 { margin: 0; }
.section-head h2 { font-size: 1.3rem; }

/* ---------- Hero + search ---------- */
.hero {
  position: relative; overflow: hidden; color: #fff;
  padding: clamp(28px, 5vw, 48px); border-radius: var(--radius-lg);
  background: radial-gradient(120% 140% at 100% 0%, #16a394 0%, var(--brand) 45%, var(--brand-ink) 100%);
  box-shadow: var(--shadow);
}
.hero::after {
  content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background:
    radial-gradient(40% 60% at 88% 20%, rgba(255,255,255,.16), transparent 60%),
    radial-gradient(30% 50% at 10% 100%, rgba(0,0,0,.18), transparent 60%);
}
.hero > * { position: relative; z-index: 1; }
.hero h1 { font-size: clamp(1.6rem, 3.6vw, 2.5rem); margin: 0 0 8px; font-weight: 800; }
.hero p { margin: 0 0 22px; opacity: .92; font-size: 1.02rem; max-width: 52ch; }
.search {
  display: flex; flex-wrap: wrap; gap: 8px; background: rgba(255,255,255,.14);
  padding: 8px; border-radius: 16px; backdrop-filter: blur(4px);
}
.search input, .search select {
  flex: 1 1 150px; padding: 12px 14px; border-radius: 11px; border: 0; font-size: .92rem;
  background: rgba(255,255,255,.96); color: #14202e; width: auto;
}
.search input:focus, .search select:focus { outline: none; box-shadow: var(--ring); }
.search .btn { flex: 0 0 auto; }

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.stat .k { color: var(--muted); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.stat .v { font-size: 1.5rem; font-weight: 800; color: var(--brand); margin-top: 2px; }

/* ---------- Grid + property cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 18px; }
.prop {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm); cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s;
  display: flex; flex-direction: column;
}
.prop:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--line-strong); }
.prop .thumb {
  height: 172px; background: linear-gradient(135deg, var(--brand-tint), var(--bg-soft));
  display: grid; place-items: center; color: var(--brand); font-size: 2.8rem; position: relative;
}
.prop .thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,.22)); }
.prop .body { padding: 15px 16px 16px; display: flex; flex-direction: column; gap: 5px; }
.prop .price { font-weight: 800; font-size: 1.24rem; color: var(--ink); letter-spacing: -.02em; }
.prop .title { font-weight: 600; color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.prop .meta { color: var(--muted); font-size: .82rem; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* Badges on cards */
.tag {
  position: absolute; top: 12px; left: 12px; z-index: 1; background: var(--accent); color: #3a2a05;
  font-weight: 800; font-size: .68rem; padding: 4px 9px; border-radius: 20px; text-transform: uppercase;
  letter-spacing: .02em; box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.tag.part { position: static; background: var(--brand-tint); color: var(--brand-ink); box-shadow: none; }
.ig-badge {
  position: absolute; top: 12px; right: 12px; z-index: 1; width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center; font-size: .95rem;
  background: linear-gradient(45deg,#f09433,#e6683c,#dc2743,#cc2366,#bc1888); color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px;
  font-size: .76rem; font-weight: 700; background: var(--bg-soft); color: var(--ink-soft);
}
.chip.ok { background: var(--brand-tint); color: var(--brand-ink); }
.chip.warn { background: var(--accent-tint); color: var(--accent-ink); }
.chip.bad { background: var(--danger-tint); color: var(--danger); }

/* ---------- Forms / panels ---------- */
.card-form, .panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm);
}
.card-form { max-width: 640px; }
.card-form h2 { font-size: 1.25rem; }
.stack { display: flex; flex-direction: column; gap: 11px; }
.row { display: flex; gap: 11px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: .82rem; font-weight: 600; color: var(--ink-soft); }
input, select, textarea {
  padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: 11px; font-size: .92rem;
  font-family: inherit; background: var(--card); color: var(--ink); width: 100%;
}
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-2); box-shadow: var(--ring); }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: .88rem; color: var(--ink-soft); }
.check input { width: auto; margin-top: 2px; accent-color: var(--brand); }

/* ---------- Dashboard ---------- */
.dash-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.orgline { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.orgline select { width: auto; }
.orgline label { color: var(--muted); font-size: .85rem; }
.badge {
  background: var(--brand); color: #fff; padding: 4px 11px; border-radius: 20px;
  font-size: .74rem; font-weight: 800; letter-spacing: .02em;
}
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.panel h3 { font-size: 1.05rem; }

/* Leads / list rows */
.lead {
  border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; display: flex;
  flex-direction: column; gap: 6px; background: var(--card);
}
.lead .lead-title { font-weight: 700; }
.lead .lead-meta { color: var(--muted); font-size: .82rem; }
.lead-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.lead .contact { background: var(--brand-tint); color: var(--brand-ink); border-radius: 9px; padding: 9px 10px; font-size: .85rem; }

/* Tables */
table.data { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.data thead th { text-align: left; color: var(--muted); font-weight: 700; font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; padding: 6px 8px; }
table.data tbody td { border-top: 1px solid var(--line); padding: 9px 8px; vertical-align: middle; }
table.data tbody tr:hover { background: var(--bg-soft); }

/* Market verdict */
.verdict { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 20px; font-weight: 800; font-size: .85rem; }
.verdict.abaixo { background: var(--brand-tint); color: var(--brand-ink); }
.verdict.dentro { background: var(--accent-tint); color: var(--accent-ink); }
.verdict.acima { background: var(--danger-tint); color: var(--danger); }
.verdict.sem { background: var(--bg-soft); color: var(--muted); }

/* Empty state */
.empty { text-align: center; color: var(--muted); padding: 26px 16px; }
.empty .ico { font-size: 2rem; opacity: .5; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(12,20,30,.55); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 60; padding: 16px; animation: fade .18s ease; }
.modal-box {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 26px;
  max-width: 560px; width: 100%; position: relative; max-height: 92vh; overflow: auto; box-shadow: var(--shadow-lg);
}
.modal-box.wide { max-width: 720px; }
.modal-close { position: absolute; top: 12px; right: 16px; border: 0; background: none; font-size: 1.7rem; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-close:hover { color: var(--ink); }
.tabs { display: flex; gap: 6px; margin-bottom: 18px; background: var(--bg-soft); padding: 5px; border-radius: 12px; }
.tab { flex: 1; padding: 10px; border: 0; background: transparent; border-radius: 9px; font-weight: 700; cursor: pointer; color: var(--muted); font-family: inherit; }
.tab.active { background: var(--card); color: var(--brand-ink); box-shadow: var(--shadow-sm); }

.detail-hero { height: 230px; border-radius: 14px; background: linear-gradient(135deg, var(--brand-tint), var(--bg-soft)); display: grid; place-items: center; font-size: 3.4rem; background-size: cover; background-position: center; }
.detail-thumbs { display: flex; gap: 7px; margin-top: 8px; overflow-x: auto; }
.detail-thumbs img { height: 58px; width: 78px; object-fit: cover; border-radius: 8px; cursor: pointer; }
.detail-price { font-size: 1.7rem; font-weight: 800; color: var(--ink); letter-spacing: -.02em; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px,1fr)); gap: 9px; margin: 16px 0; }
.detail-grid div { background: var(--bg-soft); padding: 10px 12px; border-radius: 10px; font-size: .88rem; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--card); padding: 13px 20px; border-radius: 12px; z-index: 80;
  box-shadow: var(--shadow-lg); max-width: 92%; font-weight: 600; font-size: .9rem;
  animation: pop .2s ease;
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast.err { background: var(--danger); color: #fff; }
.toast.ok { background: var(--success); color: #fff; }

/* ---------- Footer ---------- */
.foot { max-width: 1160px; margin: 40px auto 0; padding: 24px; color: var(--muted); font-size: .84rem; border-top: 1px solid var(--line); display: flex; gap: 14px; flex-wrap: wrap; justify-content: space-between; }
.foot a { color: var(--muted); }
.foot a:hover { color: var(--brand); }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .dash-grid { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .mainnav { order: 3; width: 100%; margin-left: 0; overflow-x: auto; }
}
@media (max-width: 520px) {
  .brand small { display: none; }
  .hero { border-radius: var(--radius); }
  .prop .thumb { height: 150px; }
}
