/* Área do corretor — Key Imóveis */
:root { --bg: #f3f2ef; --card: #fff; --ink: #171512; --muted: #6b645b; --line: #e2dfd9; --gold: #c8a46a; --gold-ink: #1a1510; --ok: #1f7a4d; --err: #a23b26; --dark: #141210; color-scheme: light; }
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 "Manrope", "Helvetica Neue", Arial, system-ui, sans-serif; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.1rem; margin-bottom: 14px; } h3 { font-size: 1rem; margin: 8px 0; }
.muted { color: var(--muted); } .small { font-size: 0.85rem; } .strong { font-weight: 600; text-decoration: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.adm-top { background: var(--dark); color: #f2efea; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; padding: 14px 24px; position: sticky; top: 0; z-index: 10; }
.adm-logo { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.adm-logo svg { width: 64px; height: auto; color: #f2efea; } .adm-logo .bar-mid { fill: currentColor; }
.adm-logo span { font-size: 0.85rem; color: #a9a198; }
.adm-nav { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
.adm-nav a { text-decoration: none; padding: 8px 12px; border-radius: 8px; color: #d9d3cb; }
.adm-nav a:hover { background: #2a2622; color: #fff; }
.adm-nav a[aria-current="page"] { background: #2a2622; color: #fff; }
.adm-user { display: flex; align-items: center; gap: 16px; font-size: 0.9rem; color: #d9d3cb; }
.adm-user a { text-decoration: none; } .adm-user a:hover { color: #fff; }
.adm-user form { margin: 0; }
.adm-main { max-width: 1240px; margin: 0 auto; padding: 28px 24px 80px; }

.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.head-actions form { margin: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: 600 0.9rem/1 inherit; font-family: inherit; text-decoration: none; cursor: pointer; transition: background-color .15s, border-color .15s; }
.btn:hover { border-color: #c9c4bc; background: #faf9f7; }
.btn-primary { background: var(--dark); border-color: var(--dark); color: #fff; }
.btn-primary:hover { background: #2f2a24; border-color: #2f2a24; }
.btn-danger { color: var(--err); border-color: #e7c3bb; }
.btn-danger:hover { background: #fbefec; }
.btn.block { width: 100%; }
.btn.link, button.link { background: none; border: 0; padding: 0; min-height: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; }

.alert { padding: 12px 16px; border-radius: 8px; margin: 0 0 18px; }
.alert-ok { background: #e6f3ec; color: var(--ok); }
.alert-err { background: #fbefec; color: var(--err); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 22px; margin-bottom: 18px; }
.card.narrow { max-width: 480px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.sticky { position: sticky; top: 84px; }
.danger-zone { margin-top: 8px; }

.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-size: 0.85rem; font-weight: 600; color: #3b352e; }
.form fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 14px; }
.form legend { font-weight: 600; margin-bottom: 8px; }
input:not([type=checkbox]):not([type=file]), select, textarea { font: 400 0.95rem/1.4 inherit; font-family: inherit; color: var(--ink); background: #fff; border: 1px solid #d6d2cb; border-radius: 8px; padding: 10px 12px; width: 100%; min-height: 42px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(200,164,106,.25); }
input[type=file] { font: inherit; font-size: 0.85rem; }
.form label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.form label.check input { width: 18px; height: 18px; accent-color: var(--dark); }
.row2, .row3, .row5 { display: grid; gap: 12px; align-items: end; }
.row2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.card > label + label, .card > label + .row3, .card > .row3 + .row3, .card > .row3 + label, .card > .row5 + label, .card > .row3 + .row5, .card > datalist + .row3 { margin-top: 12px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.toolbar input[type=search] { flex: 1; min-width: 220px; }
.toolbar select { width: auto; }
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 0.8rem; color: var(--muted); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .thumb img { width: 96px; height: 72px; object-fit: cover; border-radius: 6px; display: block; }
.nophoto { display: grid; place-items: center; width: 96px; height: 72px; border-radius: 6px; background: var(--bg); color: var(--muted); font-size: 0.75rem; }
.actions { white-space: nowrap; }
.actions a + a { margin-left: 14px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; }
.pill-publicado { background: #e6f3ec; color: var(--ok); } .pill-oculto { background: #eceae6; color: var(--muted); } .pill-vendido { background: #f6ecdb; color: #8a6631; }
.inline { display: flex; gap: 6px; } .inline input { min-width: 140px; }
.empty { background: #fff; border: 1px dashed #cfcac2; border-radius: 12px; padding: 40px; text-align: center; display: grid; gap: 14px; justify-items: center; }

.photos { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.photo { position: relative; border-radius: 8px; overflow: hidden; background: var(--bg); cursor: grab; border: 2px solid transparent; }
.photo.dragging { opacity: .4; } .photo.over { border-color: var(--gold); }
.photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; pointer-events: none; }
.badge-capa { display: none; position: absolute; top: 6px; left: 6px; background: var(--dark); color: #fff; font-size: 0.7rem; font-weight: 600; padding: 2px 8px; border-radius: 4px; }
#photos .photo:first-child .badge-capa { display: block; }
.photo .rm { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(20,18,16,.75); color: #fff !important; font-size: 0.75rem !important; padding: 6px 8px; display: flex !important; gap: 6px; align-items: center; cursor: pointer; }
.photo.removing img { opacity: .3; }
.preview .photo { cursor: default; }
.drop { position: relative; display: grid !important; place-items: center; border: 2px dashed #cfcac2; border-radius: 10px; padding: 24px; text-align: center; color: var(--muted) !important; cursor: pointer; transition: border-color .15s, background-color .15s; }
.drop:hover, .drop.drag { border-color: var(--gold); background: #fbf7f0; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.planta, .socio { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.planta:first-of-type, .socio:first-child { border-top: 0; padding-top: 0; }
.planta img, .socio-foto img { width: 160px; aspect-ratio: 4 / 3; object-fit: contain; background: #fafaf8; border: 1px solid var(--line); border-radius: 8px; }
.socio-foto img { aspect-ratio: 4 / 5; object-fit: cover; }
.socio-foto span { display: grid; place-items: center; width: 160px; aspect-ratio: 4 / 5; background: var(--bg); border-radius: 8px; color: var(--muted); font-size: 0.8rem; }
.planta-nova { grid-template-columns: 1fr; }
.planta-fields { display: grid; gap: 10px; }
#add-planta, #add-socio { margin-top: 10px; }
.video-prev { width: 100%; max-height: 260px; border-radius: 8px; background: #000; margin: 6px 0; }
.entrega.hidden { visibility: hidden; }

/* Login e instalador */
.adm-auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--dark); }
.auth-card { background: #fff; border-radius: 16px; padding: 36px; width: min(460px, 100%); display: grid; gap: 16px; }
.auth-logo svg { width: 96px; height: auto; color: var(--ink); } .auth-logo .bar-mid { fill: currentColor; }
.auth-card .btn-primary { width: 100%; min-height: 48px; }

@media (max-width: 900px) {
  .cols { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .row3, .row5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .adm-main { padding: 20px 14px 60px; }
  .row2, .row3, .row5 { grid-template-columns: 1fr; }
  .planta, .socio { grid-template-columns: 1fr; }
  .table .thumb { display: none; }
}

.mk-intro { max-width: 70ch; margin: -8px 0 20px; }
.mk-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; } .mk-head h2 { margin: 0; }
.mk-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; } .mk-list b { display: block; } .mk-list span { color: var(--muted); font-size: .85rem; }
code { font-size: .85em; background: var(--bg); padding: 1px 5px; border-radius: 4px; }

/* ---------- CRM ---------- */
.adm-main.wide { max-width: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ok { color: var(--ok); }
.crm-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -6px 0 18px; overflow-x: auto; }
.crm-tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.crm-tabs a:hover { color: var(--ink); }
.crm-tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--gold); }
.toolbar-sum { margin-left: auto; align-self: center; color: var(--muted); font-size: .9rem; }
.toolbar-sum b { color: var(--ink); }
.check-inline { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; gap: 2px; min-width: 0; }
.kpi span { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.kpi b { font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi.warn b { color: var(--err); }

.score { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #eceae6; color: var(--muted); white-space: nowrap; }
.score-4 { background: #f6ecdb; color: #8a6631; }
.score-5 { background: var(--dark); color: #e0c28d; }
.selo { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: #ebe6dd; color: #4a4239; }
.selo-vazio { background: #fbefec; color: var(--err); }
.pill-aberto { background: #eceae6; color: var(--ink); } .pill-ganho { background: #e6f3ec; color: var(--ok); } .pill-perdido { background: #fbefec; color: var(--err); }

/* Pipeline */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(210px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.stage { background: #e9e7e2; border-radius: 12px; padding: 10px; min-height: 360px; display: grid; gap: 10px; align-content: start; transition: background-color .15s; }
.stage.over { background: #efe5d3; outline: 2px dashed var(--gold); outline-offset: -2px; }
.stage header { padding: 4px 6px 8px; border-bottom: 2px solid #d6d2cb; display: grid; gap: 2px; }
.stage-won header { border-bottom-color: var(--ok); }
.stage header h2 { font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin: 0; }
.stage header b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.stage header small { font-size: .75rem; }
.stage-cards { display: grid; gap: 8px; }
.stage-empty { color: var(--muted); font-size: .8rem; text-align: center; padding: 18px 6px; border: 1px dashed #cfcac2; border-radius: 10px; margin: 0; }
.deal { display: grid; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; text-decoration: none; cursor: grab; transition: border-color .15s, box-shadow .15s; }
.deal:hover { border-color: var(--gold); box-shadow: 0 2px 8px rgba(20,18,16,.06); }
.deal.dragging { opacity: .4; }
.deal-top { display: flex; justify-content: space-between; gap: 8px; align-items: start; }
.deal-top strong { font-weight: 600; line-height: 1.3; }
.deal-prod { font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deal-val { font-weight: 600; font-variant-numeric: tabular-nums; }
.deal-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .75rem; margin-top: 2px; }
.deal-meta { display: flex; gap: 6px; align-items: center; }
.next { color: #4a4239; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.next.late { color: var(--err); font-weight: 600; }
.next.none { color: #b0853f; }

/* Negócio */
.deal-page { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; align-items: start; }
.contact-card { display: grid; gap: 8px; justify-items: start; }
.contact-card h2 { margin: 4px 0 0; font-size: 1.2rem; }
.contact-card p { margin: 0; }
.avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--dark); color: #e0c28d; display: grid; place-items: center; font-weight: 700; font-size: 1.1rem; }
.btn-wa { background: #25d366; border-color: #25d366; color: #06301a; }
.btn-wa:hover { background: #22c25e; border-color: #22c25e; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { background: #196542; border-color: #196542; }
.btn-lose { background: var(--err); border-color: var(--err); color: #fff; }
.btn-lose:hover { background: #8a301e; border-color: #8a301e; }
.kv { margin: 0; display: grid; gap: 8px; }
.kv div { display: flex; justify-content: space-between; gap: 12px; font-size: .9rem; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.kv div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; text-align: right; }
.mini-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.mini-kpis div { border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: grid; }
.mini-kpis span { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.mini-kpis b { font-variant-numeric: tabular-nums; }
.other-deal { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); text-decoration: none; font-size: .9rem; }
.col-side .other-deal:last-of-type { margin-bottom: 12px; }
.notes { margin: 0; white-space: normal; font-size: .9rem; }

.win-lose { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; margin-bottom: 18px; }
.win-lose form { margin: 0; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.lose summary { list-style: none; } .lose summary::-webkit-details-marker { display: none; }
.lose[open] summary { display: none; }
.lose-form { background: #fff; border: 1px solid #e7c3bb; border-radius: 12px; padding: 14px; min-width: 280px; display: grid !important; }
.closed-note { margin: 0; align-self: center; display: flex; gap: 8px; align-items: center; }

.stepper { list-style: none; margin: 0 0 8px; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.stepper li { position: relative; }
.stepper li::before { content: ""; position: absolute; top: 15px; left: -50%; right: 50%; height: 2px; background: var(--line); }
.stepper li:first-child::before { display: none; }
.stepper li.done::before, .stepper li.current::before, .stepper li.lost::before { background: var(--gold); }
.stepper form { margin: 0; }
.stepper button { position: relative; width: 100%; background: none; border: 0; padding: 4px 2px; display: grid; justify-items: center; gap: 4px; font: inherit; cursor: pointer; color: var(--muted); }
.stepper button:disabled { cursor: default; }
.stepper button:hover:not(:disabled) span { color: var(--ink); }
.stepper i { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 2px solid #cfcac2; margin-top: 4px; }
.stepper span { font-size: .78rem; font-weight: 600; text-align: center; line-height: 1.2; }
.stepper small { font-size: .72rem; }
.stepper .done i { background: var(--gold); border-color: var(--gold); }
.stepper .current i { background: var(--dark); border-color: var(--dark); box-shadow: 0 0 0 4px rgba(200,164,106,.35); }
.stepper .current span { color: var(--ink); }
.stepper .lost i { background: var(--err); border-color: var(--err); }

.act-form { margin-bottom: 8px; }
.act-types { display: flex; flex-wrap: wrap; gap: 6px; }
.act-types label { display: block !important; cursor: pointer; position: relative; }
.act-types input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; pointer-events: none; }
.act-types span { display: inline-block; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: .85rem; font-weight: 600; color: var(--muted); background: #fff; }
.act-types input:checked + span { background: var(--dark); border-color: var(--dark); color: #fff; }
.act-types input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.acts-title { margin-top: 18px; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.acts { list-style: none; margin: 0; padding: 0; }
.act { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.act:first-child { border-top: 0; }
.act-body { display: grid; gap: 2px; min-width: 0; }
.act-body p { margin: 2px 0; }
.act-tag { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #8a6631; }
.act.late .act-tag, .act.late .act-body > .muted { color: var(--err); }
.act.done .act-body p { color: var(--muted); }
.act.sys .act-tag { color: var(--muted); }
.act.sys .act-body p { font-size: .9rem; }
.act-actions { display: flex; gap: 12px; align-items: center; flex-shrink: 0; }
.act-actions form { margin: 0; }
.act-actions .btn { min-height: 34px; padding: 0 12px; }

@media (max-width: 900px) {
  .deal-page { grid-template-columns: 1fr; }
  .kpis-3 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .board { grid-auto-columns: 82vw; }
  .stepper { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 12px; }
  .stepper li::before { display: none; }
  .act { flex-direction: column; }
  .toolbar-sum { margin-left: 0; width: 100%; }
}
