/* ==========================================================================
   buyer-agent-pr — design system  ("Apex Cobalt")
   Primary #002F6C · Secondary #00A86B · Tertiary #FFBF00 · Neutral #4A4A4A
   Headline: Manrope · Body/Label: Inter
   ========================================================================== */

:root {
  /* brand ramps */
  --navy:        #002F6C;
  --navy-800:    #06306E;
  --navy-700:    #0A3A82;
  --navy-600:    #1B57B0;
  --navy-500:    #2C6BD1;
  --navy-100:    #D7E3F6;
  --navy-50:     #EDF3FC;

  --green:       #00A86B;
  --green-700:   #00744A;
  --green-100:   #CFEEDF;
  --green-50:    #E7F6EF;

  --amber:       #FFBF00;
  --amber-800:   #8A6800;
  --amber-100:   #FFECB3;
  --amber-50:    #FFF7E0;

  --red:         #E23D3D;
  --red-700:     #B02626;
  --red-100:     #F7D5D5;
  --red-50:      #FDECEC;

  /* neutrals */
  --ink:         #1E2530;
  --ink-2:       #59636F;
  --ink-3:       #8B94A2;
  --line:        #E6EAF1;
  --line-2:      #EFF2F7;
  --bg:          #F5F7FB;
  --card:        #FFFFFF;

  /* shape */
  --r-card:      12px;
  --r-field:     9px;
  --r-sm:        8px;
  --r-pill:      999px;
  --sidebar-active: #1B57B0;   /* item ativo: só um tom mais claro que o navy */
  --shadow-card: 0 1px 2px rgba(20,30,55,.04), 0 6px 20px -14px rgba(20,30,55,.12);
  --shadow-pop:  0 14px 36px -16px rgba(20,30,55,.24);

  /* type */
  --font-head: "Manrope", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, sans-serif;

  color-scheme: light;
}

* { box-sizing: border-box; }

svg.ic { width: 18px; height: 18px; display: inline-block; vertical-align: middle; flex: none; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 800; line-height: 1.2; margin: 0; color: var(--ink); }
h1 { font-size: 1.6rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p  { margin: 0; }

a { color: var(--navy-600); text-decoration: none; }
a:hover { text-decoration: underline; }

small { font-size: .82rem; color: var(--ink-2); }

.muted { color: var(--ink-2); }
.label {
  font-family: var(--font-body);
  font-size: .68rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3);
}
.tnum { font-family: var(--font-head); font-variant-numeric: tabular-nums; }

/* ---- app shell (internal) ---------------------------------------------- */

.app { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--navy);
  color: #fff;
  padding: 22px 16px;
  display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; }
.brand__mark {
  width: 38px; height: 38px; border-radius: 9px;
  background: rgba(255,255,255,.14);
  display: grid; place-items: center; flex: none;
}
.brand__mark svg { width: 20px; height: 20px; color: #fff; }
.brand__name { font-family: var(--font-head); font-weight: 800; font-size: 1.05rem; }
.brand__sub  { font-size: .68rem; color: rgba(255,255,255,.55); letter-spacing: .04em; }

.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px;
  color: rgba(255,255,255,.74); font-weight: 500; font-size: .9rem;
  transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.nav a.is-active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav__sep { font-size: .62rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: rgba(255,255,255,.4); padding: 14px 12px 6px; }

.sidebar__foot { margin-top: auto; }
.userchip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: 10px;
  background: rgba(255,255,255,.07);
}
.userchip__avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--amber); color: #3a2c00;
  display: grid; place-items: center; font-family: var(--font-head); font-weight: 800; font-size: .8rem; flex: none;
}
.userchip__name { font-size: .82rem; font-weight: 600; }
.userchip__role { font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.5); }
.userchip form { margin: 0; }
.userchip button {
  background: transparent; border: 0; color: rgba(255,255,255,.6);
  cursor: pointer; padding: 6px; border-radius: 8px; display: grid; place-items: center;
}
.userchip button:hover { background: rgba(255,255,255,.12); color: #fff; }
.userchip button svg { width: 16px; height: 16px; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 66px; flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 0 26px;
  background: #fff; border-bottom: 1px solid var(--line);
}
.topbar__title { font-family: var(--font-head); font-weight: 700; font-size: 1rem; }
.topbar__actions { display: flex; align-items: center; gap: 8px; }
.iconbtn {
  width: 38px; height: 38px; border-radius: 9px;
  border: 1px solid var(--line); background: #fff;
  display: grid; place-items: center; cursor: pointer; color: var(--ink-2);
}
.iconbtn:hover { background: var(--navy-50); color: var(--navy); }
.iconbtn svg { width: 17px; height: 17px; }

.content {
  padding: 26px;
  display: flex; flex-direction: column; gap: 22px;
  width: 100%; max-width: 1160px; margin: 0 auto;
}

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { color: var(--ink-2); font-size: .92rem; margin-top: 2px; }

/* ---- cards ------------------------------------------------------------- */

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: 22px;
  box-shadow: var(--shadow-card);
}
.card--flush { padding: 0; overflow: hidden; }
.card--dark {
  background: linear-gradient(158deg, var(--navy-700), var(--navy) 60%, #012154);
  color: #fff; border-color: transparent;
}
.card--dark .label { color: rgba(255,255,255,.6); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card__head p { color: var(--ink-2); font-size: .88rem; }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }

.stat__value { font-family: var(--font-head); font-weight: 800; font-size: 1.9rem; letter-spacing: -.02em; }
.stat__unit { color: var(--ink-2); font-size: .82rem; margin-left: 4px; }
.card--dark .stat__unit { color: rgba(255,255,255,.7); }

.chip-icon {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: var(--navy-50); color: var(--navy);
}
.chip-icon svg { width: 16px; height: 16px; }
.card--dark .chip-icon { background: rgba(255,255,255,.12); color: #fff; }

/* ---- buttons -------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-body); font-weight: 600; font-size: .9rem;
  padding: 10px 16px; border-radius: var(--r-field);
  border: 1px solid transparent; cursor: pointer; transition: background .15s, border-color .15s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn--primary { background: var(--navy); color: #fff; }
.btn--primary:hover { background: var(--navy-700); }
.btn--ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { background: var(--bg); }
.btn--danger { background: var(--red-50); color: var(--red-700); }
.btn--danger:hover { background: var(--red-100); }
.btn--sm { padding: 7px 12px; font-size: .82rem; }
.btn--block { width: 100%; justify-content: center; }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---- forms ------------------------------------------------------------- */

.field { margin-bottom: 15px; }
label { display: block; font-size: .82rem; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; font-family: var(--font-body); font-size: .92rem; color: var(--ink);
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-field);
  background: #fff; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 84px; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--navy-600); box-shadow: 0 0 0 3px var(--navy-50);
}
input[type="checkbox"] { width: auto; accent-color: var(--navy-600); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

fieldset { border: 1px solid var(--line); border-radius: var(--r-field); padding: 14px 16px; margin: 0 0 15px; }
fieldset legend { font-size: .82rem; font-weight: 600; padding: 0 6px; color: var(--ink-2); }
.checks { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.checks label { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 0; font-size: .9rem; }

.searchbox {
  position: relative; width: 320px; max-width: 40vw;
}
.searchbox input {
  border-radius: var(--r-pill); background: var(--bg); border-color: transparent;
  padding-left: 38px;
}
.searchbox input:focus { background: #fff; }
.searchbox svg {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--ink-3);
}

/* ---- tables ---------------------------------------------------------------- */

.table { width: 100%; border-collapse: collapse; }
.table thead th {
  text-align: left; font-size: .68rem; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3);
  padding: 16px 14px 12px;
}
.table tbody td { padding: 14px; border-top: 1px solid var(--line-2); font-size: .9rem; vertical-align: middle; }
.table tbody tr:last-child td { padding-bottom: 16px; }
/* respiro nas bordas — evita que o texto encoste no canto arredondado do card */
.table th:first-child, .table td:first-child { padding-left: 22px; }
.table th:last-child,  .table td:last-child  { padding-right: 22px; }
.table tbody tr:hover td { background: var(--bg); }
.table .t-id { font-family: var(--font-head); font-weight: 700; color: var(--navy-600); font-variant-numeric: tabular-nums; }
.table .t-num { text-align: right; font-family: var(--font-head); font-weight: 700; font-variant-numeric: tabular-nums; }
.table .t-actions { text-align: right; white-space: nowrap; }
.table .empty { padding: 20px 22px; }
.table-wrap { overflow-x: auto; }

.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: var(--navy-100); color: var(--navy);
  display: grid; place-items: center; font-family: var(--font-head); font-weight: 700; font-size: .72rem;
}
.person { display: flex; align-items: center; gap: 10px; }

/* ---- pills ----------------------------------------------------------------- */

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--r-pill);
  font-size: .74rem; font-weight: 600; line-height: 1.4; white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.pill--plain::before { display: none; }
.pill--green { background: var(--green-50); color: var(--green-700); }
.pill--amber { background: var(--amber-50); color: var(--amber-800); }
.pill--red   { background: var(--red-50);   color: var(--red-700); }
.pill--blue  { background: var(--navy-50);  color: var(--navy-600); }
.pill--gray  { background: var(--line-2);   color: var(--ink-2); }

.live {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: var(--r-pill);
  background: var(--green-50); color: var(--green-700);
  font-size: .76rem; font-weight: 600;
}
.live::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 0 rgba(0,168,107,.5); animation: pulse 2s infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 6px rgba(0,168,107,0); } 100% { box-shadow: 0 0 0 0 rgba(0,168,107,0); } }

/* ---- progress bar -------------------------------------------------------- */

.bar { width: 110px; height: 8px; border-radius: var(--r-pill); background: var(--line-2); overflow: hidden; display: inline-block; vertical-align: middle; }
.bar__fill { display: block; height: 100%; background: var(--navy); border-radius: var(--r-pill); }
.bar__fill--green { background: var(--green); }
.bar__fill--amber { background: var(--amber); }
.bar__fill--red { background: var(--red); }
.scorecell { display: flex; align-items: center; gap: 10px; }

/* ---- alerts ------------------------------------------------------------- */

.alert { padding: 12px 14px; border-radius: var(--r-field); font-size: .9rem; margin-bottom: 15px; }
.alert--error { background: var(--red-50); color: var(--red-700); border: 1px solid var(--red-100); }
.alert--ok { background: var(--green-50); color: var(--green-700); border: 1px solid var(--green-100); }
.alert--info { background: var(--navy-50); color: var(--navy-700); border: 1px solid var(--navy-100); }
.alert ul { margin: 0; padding-left: 18px; }
.spinner { display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: girar .7s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
#scrape-status progress { accent-color: var(--navy-600); border-radius: 3px; }

/* ---- misc -------------------------------------------------------------- */

.kv { width: 100%; border-collapse: collapse; }
.kv th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: .82rem; padding: 9px 12px 9px 0; width: 40%; vertical-align: top; }
.kv td { padding: 9px 0; border-top: 1px solid var(--line-2); }
.kv tr:first-child th, .kv tr:first-child td { border-top: 0; }

.empty { color: var(--ink-2); font-size: .9rem; padding: 8px 0; }

details > summary { cursor: pointer; font-weight: 600; color: var(--ink-2); font-size: .88rem; padding: 6px 0; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---- centered pane (login) -------------------------------------------- */

.centerpane { min-height: 100vh; display: grid; place-items: center; background: var(--bg); padding: 24px; }
.authcard {
  width: 100%; max-width: 370px; background: #fff;
  border: 1px solid var(--line); border-radius: 12px; padding: 32px;
  box-shadow: var(--shadow-pop);
}
.authcard__brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; color: var(--navy); }
.authcard__brand .brand__mark { background: var(--navy-50); }
.authcard__brand .brand__mark svg { color: var(--navy); }
.authcard__brand .brand__name { color: var(--ink); }
.authcard__brand .brand__sub { color: var(--ink-3); }

/* ---- public (lead-facing) ------------------------------------------------ */

.pub-body { background: var(--bg); }
.pub {
  max-width: 1000px; margin: 0 auto; padding: 40px 20px 64px;
}
.pub--narrow { max-width: 460px; }
.pub__title { font-size: 1.7rem; letter-spacing: -.02em; }
.pub__lede { color: var(--ink-2); font-size: 1rem; margin-top: 8px; }

.panel {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 28px; box-shadow: var(--shadow-card);
}

.imovel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; margin-top: 24px; }
.imovel-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-card);
  overflow: hidden; box-shadow: var(--shadow-card); display: flex; flex-direction: column;
  transition: transform .15s, box-shadow .15s;
}
.imovel-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-pop); text-decoration: none; }
.imovel-card__media {
  aspect-ratio: 4 / 3; background: var(--navy-50); position: relative;
  display: grid; place-items: center;
}
.imovel-card__media img { width: 100%; height: 100%; object-fit: cover; }
.imovel-card__media .noimg { color: var(--navy-100); font-size: .8rem; font-weight: 600; }
.imovel-card__body { padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.imovel-card__title { font-family: var(--font-head); font-weight: 700; font-size: .98rem; color: var(--ink); }
.imovel-card__meta { color: var(--ink-2); font-size: .84rem; }
.price { font-family: var(--font-head); font-weight: 800; font-size: 1.2rem; color: var(--navy); margin-top: 4px; }

.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 20px 0; }
.gallery a { display: block; border-radius: 10px; overflow: hidden; background: var(--navy-50); }
.gallery img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; display: block; transition: transform .2s; }
.gallery a:first-child { grid-column: 1 / -1; }
.gallery a:first-child img { aspect-ratio: 16 / 9; }
.gallery a:hover img { transform: scale(1.03); }

/* thumbnails (tela interna) */
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { width: 104px; height: 78px; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--line); display: block; flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb:hover { border-color: var(--navy-600); }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 1000;
  background: rgba(8,17,34,.94); display: flex; align-items: center; justify-content: center; }
.lightbox[hidden] { display: none; }  /* o atributo `hidden` do JS precisa vencer o display:flex */
.lightbox__img { max-width: 92vw; max-height: 86vh; border-radius: 8px;
  box-shadow: 0 20px 60px -10px rgba(0,0,0,.6); }
.lightbox__close, .lightbox__nav {
  position: absolute; background: rgba(255,255,255,.1); color: #fff; border: 0;
  cursor: pointer; border-radius: 50%; display: grid; place-items: center;
  transition: background .15s; line-height: 1; }
.lightbox__close:hover, .lightbox__nav:hover { background: rgba(255,255,255,.22); }
.lightbox__close { top: 18px; right: 20px; width: 40px; height: 40px; font-size: 1.6rem; }
.lightbox__nav { top: 50%; transform: translateY(-50%); width: 48px; height: 48px; font-size: 2rem; }
.lightbox__prev { left: 16px; } .lightbox__next { right: 16px; }
.lightbox__count { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  color: rgba(255,255,255,.8); font-size: .85rem; font-variant-numeric: tabular-nums; }

.feature-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.feature-tags span { background: var(--navy-50); color: var(--navy-600); border-radius: var(--r-pill); padding: 5px 12px; font-size: .8rem; font-weight: 600; }

.pin-input {
  font-family: var(--font-head); font-size: 1.6rem; font-weight: 800;
  letter-spacing: .5em; text-align: center; padding: 14px 12px;
}

.backlink { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 500; font-size: .88rem; margin-bottom: 18px; }
.backlink:hover { color: var(--navy); text-decoration: none; }

/* ---- responsive ------------------------------------------------------- */

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; flex-direction: row; align-items: center;
    gap: 4px; padding: 10px 12px; overflow-x: auto;
  }
  .brand { padding: 0 8px 0 4px; }
  .brand__sub { display: none; }
  .nav { flex-direction: row; margin: 0; }
  .nav a span { display: none; }
  .sidebar__foot { margin: 0 0 0 auto; }
  .userchip__name, .userchip__role { display: none; }
  .searchbox { display: none; }
  .grid-3 { grid-template-columns: 1fr; }
  .content { padding: 18px; }
}
