/* ============================================================
   Sistema de Imóveis — tema fiel ao shadcn/ui do sistema original
   Paleta HSL copiada de src/index.css
   ============================================================ */
:root {
  --background: 24 10% 98%;
  --foreground: 24 10% 10%;
  --card: 0 0% 100%;
  --card-foreground: 24 10% 10%;
  --primary: 24 6% 25%;
  --primary-foreground: 60 9% 98%;
  --secondary: 60 5% 96%;
  --secondary-foreground: 24 6% 10%;
  --muted: 60 5% 96%;
  --muted-foreground: 25 6% 45%;
  --accent: 60 5% 90%;
  --success: 142 76% 36%;
  --warning: 38 92% 50%;
  --destructive: 0 84% 60%;
  --border: 20 6% 90%;
  --input: 20 6% 90%;
  --ring: 24 6% 25%;
  --chart-1: 217 91% 60%;
  --radius: 0.5rem;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-size: 14px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }

/* Header / nav */
.header {
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  position: sticky; top: 0; z-index: 50;
}
.header-inner { padding: 1rem; }
.header-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.header-title { font-size: 1.5rem; font-weight: 700; }
.header-sub { font-size: 0.8rem; color: hsl(var(--muted-foreground)); }
.nav { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.nav a {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.9rem; border-radius: var(--radius);
  font-weight: 500; font-size: 0.9rem; color: hsl(var(--foreground));
}
.nav a:hover { background: hsl(var(--accent)); }
.nav a.active { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }

main { padding: 2rem 0; }
.page-title { font-size: 1.85rem; font-weight: 700; margin-bottom: 0.25rem; }
.page-sub { color: hsl(var(--muted-foreground)); margin-bottom: 1.5rem; }

/* Cards */
.card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.card-header { padding: 1.25rem 1.25rem 0.75rem; }
.card-body { padding: 1.25rem; }
.card-title { font-size: 1.05rem; font-weight: 600; }
.card-desc { font-size: 0.85rem; color: hsl(var(--muted-foreground)); margin-top: 0.15rem; }

.grid { display: grid; gap: 1.5rem; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .grid-4 { grid-template-columns: 1fr; } }

/* Stat cards */
.stat { position: relative; overflow: hidden; }
.stat.border-primary { border-left: 4px solid hsl(var(--primary)); }
.stat.border-chart { border-left: 4px solid hsl(var(--chart-1)); }
.stat.border-warning { border-left: 4px solid hsl(var(--warning)); }
.stat.border-destructive { border-left: 4px solid hsl(var(--destructive)); }
.stat.border-success { border-left: 4px solid hsl(var(--success)); }
.stat-label { font-size: 0.8rem; font-weight: 500; color: hsl(var(--muted-foreground)); }
.stat-value { font-size: 1.9rem; font-weight: 700; margin-top: 0.5rem; }
.stat-value.destructive { color: hsl(var(--destructive)); }
.stat-value.success { color: hsl(var(--success)); }
.stat-hint { font-size: 0.72rem; color: hsl(var(--muted-foreground)); margin-top: 0.4rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem; justify-content: center;
  padding: 0.5rem 1rem; border-radius: var(--radius);
  font-weight: 500; font-size: 0.88rem; cursor: pointer;
  border: 1px solid transparent; background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  transition: opacity .15s;
}
.btn:hover { opacity: 0.9; }
.btn-outline { background: transparent; color: hsl(var(--foreground)); border-color: hsl(var(--border)); }
.btn-outline:hover { background: hsl(var(--accent)); opacity: 1; }
.btn-ghost { background: transparent; color: hsl(var(--foreground)); }
.btn-ghost:hover { background: hsl(var(--accent)); }
.btn-destructive { background: hsl(var(--destructive)); color: #fff; }
.btn-success { background: hsl(var(--success)); color: #fff; }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-icon { padding: 0.4rem; }

/* Forms */
.form-group { margin-bottom: 1rem; }
label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 0.35rem; }
input, select, textarea {
  width: 100%; padding: 0.5rem 0.75rem; font-size: 0.9rem; font-family: inherit;
  border: 1px solid hsl(var(--input)); border-radius: var(--radius);
  background: hsl(var(--background)); color: hsl(var(--foreground));
}
input:focus, select:focus, textarea:focus { outline: 2px solid hsl(var(--ring)); outline-offset: 1px; }
textarea { min-height: 70px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }
.checkbox-row { display: flex; align-items: center; gap: 0.5rem; }
.checkbox-row input { width: auto; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 0.8rem; font-weight: 600; color: hsl(var(--muted-foreground));
  padding: 0.6rem 0.75rem; border-bottom: 1px solid hsl(var(--border));
}
thead th a { color: inherit; cursor: pointer; white-space: nowrap; }
thead th a:hover { text-decoration: underline; }
tbody td { padding: 0.7rem 0.75rem; border-bottom: 1px solid hsl(var(--border)); font-size: 0.88rem; }
tbody tr:hover { background: hsl(var(--muted)); }
.table-wrap { border: 1px solid hsl(var(--border)); border-radius: var(--radius); overflow-x: auto; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }

/* Linha de botões de ação (ícones), sem quebra */
.actions { display: flex; gap: 0.35rem; justify-content: flex-end; align-items: center; white-space: nowrap; }
.actions form { display: inline-flex; margin: 0; }
.btn svg { display: block; }
.btn-icon { padding: 0.4rem; line-height: 0; }
.btn-danger { background: transparent; color: hsl(var(--destructive)); border-color: hsl(var(--destructive)); }
.btn-danger:hover { background: hsl(var(--destructive) / 0.1); opacity: 1; }

/* Badges */
.badge {
  display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px;
  font-size: 0.72rem; font-weight: 600;
}
.badge-default { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.badge-secondary { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }
.badge-success { background: hsl(var(--success)); color: #fff; }
.badge-destructive { background: hsl(var(--destructive)); color: #fff; }

/* Filters bar */
.filters { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; background: hsl(var(--muted)); padding: 1rem; border-radius: var(--radius); }
.filters .form-group { margin-bottom: 0; flex: 1; min-width: 180px; }

/* Modal / dialog */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 2rem 1rem; overflow-y: auto;
}
.modal {
  background: hsl(var(--card)); border-radius: var(--radius); width: 100%; max-width: 640px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.25); margin: auto;
}
.modal-header { padding: 1.25rem 1.25rem 0; }
.modal-title { font-size: 1.15rem; font-weight: 600; }
.modal-body { padding: 1.25rem; }
.modal-footer { display: flex; justify-content: flex-end; gap: 0.5rem; padding: 0 1.25rem 1.25rem; }
[hidden] { display: none !important; }

/* Flash */
.flash { padding: 0.85rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.9rem; }
.flash-success { background: hsl(var(--success) / 0.12); border: 1px solid hsl(var(--success)); color: hsl(142 76% 26%); }
.flash-error { background: hsl(var(--destructive) / 0.1); border: 1px solid hsl(var(--destructive)); color: hsl(0 74% 42%); }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-box { width: 100%; max-width: 400px; }
.login-logo { width: 64px; height: 64px; margin: 0 auto 1rem; background: hsl(var(--primary)); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; }
.login-head { text-align: center; margin-bottom: 2rem; }

.muted { color: hsl(var(--muted-foreground)); }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mb-2 { margin-bottom: 1rem; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; } .gap-2 { gap: 0.5rem; }
.chart-box { position: relative; height: 300px; }
.empty { text-align: center; padding: 3rem 1rem; color: hsl(var(--muted-foreground)); }
.pagination { display: flex; align-items: center; justify-content: space-between; margin-top: 1rem; }
.tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.tabs button { flex: 1; }
