/* app.css — Stuart Imóveis · Painel interno dos corretores
   Direção: ferramenta de uso diário. Sobriedade e legibilidade primeiro;
   a "ousadia" fica reservada à coluna de etapas do Kanban (cor semântica
   por estágio) e ao código de referência do imóvel em fonte mono, como um
   SKU de catálogo. Tudo o mais é quieto e disciplinado. */

:root {
  --ink:        #2B2C30;
  --ink-soft:   #2b2c3008;
  --bg:         #F6F6F4;
  --surface:    #FFFFFF;
  --border:     #E9E8E5;
  --border-2:   #F1F0ED;
  --muted:      #6C6E73;
  --muted-2:    #9B9DA2;
  --accent:     #FF7C00;
  --accent-ink: #D96A00;
  --accent-soft:#FFF1E3;

  /* Cores semânticas das etapas do pipeline (mantidas discretas) */
  --st-novo:        #8A8E96;
  --st-atendimento: #3B82C4;
  --st-visita:      #8C5BD0;
  --st-proposta:    #E0A21E;
  --st-fechamento:  #2E9CC9;
  --st-ganho:       #2E9E5B;
  --st-perdido:     #D85151;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(43,44,48,.04), 0 4px 16px rgba(43,44,48,.05);
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 24px;
  height: 60px; padding: 0 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; letter-spacing: -.01em; }
.brand .logo { height: 34px; width: auto; display: block; }
.brand .sub { font-weight: 700; color: var(--muted-2); font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  padding-left: 11px; border-left: 1px solid var(--border); }
.brand .mark { color: var(--accent); }
.nav { display: flex; gap: 4px; margin-left: 6px; }
.nav a {
  padding: 7px 13px; border-radius: 8px; color: var(--muted);
  font-size: 14px; font-weight: 700;
}
.nav a:hover { background: var(--bg); color: var(--ink); }
.nav a.active { background: var(--accent-soft); color: var(--accent-ink); }
.topbar .spacer { flex: 1; }
.user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--ink); font: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: .12s; white-space: nowrap;
}
.btn:hover { border-color: var(--muted-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--bg); color: var(--ink); border-color: transparent; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- Inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--muted); letter-spacing: .01em; }
input, select, textarea {
  font: inherit; font-size: 14px; color: var(--ink);
  padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px;
  background: var(--bg); color: var(--muted); border: 1px solid var(--border-2);
}
.code { font-family: var(--mono); font-size: 12.5px; letter-spacing: -.02em; color: var(--accent-ink); }

/* ---------- Layout de página ---------- */
.page { padding: 22px; }
.page-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 21px; margin: 0; letter-spacing: -.02em; }
.page-head .spacer { flex: 1; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .search { width: 260px; max-width: 50vw; }

/* ---------- Kanban ---------- */
.board {
  display: flex; gap: 14px; overflow-x: auto; padding-bottom: 14px;
  align-items: flex-start;
}
.col {
  flex: 0 0 282px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; max-height: calc(100vh - 165px);
}
.col-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--border-2);
}
.col-head .dot { width: 9px; height: 9px; border-radius: 999px; flex: 0 0 auto; }
.col-head .name { font-weight: 600; font-size: 13.5px; }
.col-head .count { margin-left: auto; font-size: 12px; color: var(--muted-2); font-weight: 600;
  background: var(--bg); padding: 1px 8px; border-radius: 999px; }
.col-body { padding: 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; min-height: 60px; }
.col.drag-over .col-body { background: var(--accent-soft); border-radius: 0 0 var(--radius) var(--radius); }
.col-empty { color: var(--muted-2); font-size: 12.5px; text-align: center; padding: 18px 6px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--st-novo); border-radius: var(--radius-sm);
  padding: 15px 16px; min-height: 72px; flex-shrink: 0;
  cursor: grab; transition: box-shadow .12s, transform .05s;
}
.card:hover { box-shadow: var(--shadow); }
.card:active { cursor: grabbing; }
.card.dragging { opacity: .45; }
.card .nome { font-weight: 600; font-size: 15px; margin-bottom: 0; }
.card .meta { font-size: 12.5px; color: var(--muted); line-height: 1.5; word-break: break-word; }
.card .row { display: flex; align-items: center; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.card .when { font-size: 11.5px; color: var(--muted-2); }

/* ---------- Modal ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(27,42,42,.32);
  display: none; align-items: center; justify-content: center; z-index: 60; padding: 20px;
}
.modal-bg.open { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 480px;
  max-height: 88vh; overflow: auto; box-shadow: 0 24px 60px rgba(27,42,42,.22);
}
.modal-head { display: flex; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border-2); }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-head .x { margin-left: auto; }
.modal-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border-2); display: flex; gap: 10px; justify-content: flex-end; }

.kv { display: grid; grid-template-columns: 120px 1fr; gap: 4px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); word-break: break-word; }

/* ---------- Estados ---------- */
.loading, .empty { padding: 50px 20px; text-align: center; color: var(--muted); }
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px;
  font-size: 13.5px; box-shadow: var(--shadow); z-index: 80; opacity: 0; transition: opacity .2s;
  pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.err { background: var(--st-perdido); }

/* ---------- Tabela de imóveis (usada na próxima etapa) ---------- */
.table { width: 100%; border-collapse: collapse; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--border); background: var(--bg); }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border-2); font-size: 13.5px; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--ink-soft); }

@media (max-width: 640px) {
  .topbar { gap: 12px; padding: 0 14px; }
  .brand .sub { display: none; }
  .page { padding: 14px; }
  .toolbar .search { max-width: 100%; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
