/* ──────────────────────────────────────────────────────────
   Lucas OS — Sistema visual v2
   Filosofia: clareza brutal · 1 mensagem por tela ·
              tipografia opinionada · cores semânticas
   ────────────────────────────────────────────────────────── */

/* ━━━━━━━━━━ DESIGN TOKENS ━━━━━━━━━━ */
:root {
  /* Paleta — neutros profundos, acentos sóbrios */
  --bg:           #0a0e16;       /* fundo: quase preto, leve azul */
  --bg-elev-1:   #131823;        /* superfícies elevadas */
  --bg-elev-2:   #1a2030;        /* cards, modals */
  --bg-elev-3:   #232a3a;        /* hover, inputs */
  --line:        #2a3142;        /* divisores sutis */
  --line-bright: #3a4258;

  /* Texto */
  --text:        #f1f5f9;        /* principal */
  --text-muted:  #94a3b8;        /* secundário */
  --text-dim:    #64748b;        /* terciário, captions */

  /* Cores semânticas — sóbrias, não néon */
  --positive:    #22c55e;
  --positive-bg: rgba(34, 197, 94, 0.08);
  --negative:    #ef4444;
  --negative-bg: rgba(239, 68, 68, 0.08);
  --warning:     #f59e0b;
  --warning-bg:  rgba(245, 158, 11, 0.10);
  --info:        #38bdf8;
  --info-bg:     rgba(56, 189, 248, 0.08);
  --gold:        #fbbf24;        /* destaque premium */

  /* Tipografia */
  --font-display: ui-rounded, -apple-system, 'SF Pro Display', system-ui, sans-serif;
  --font-text:    -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', system-ui, sans-serif;
  --font-mono:    ui-monospace, 'SF Mono', 'Cascadia Code', 'Roboto Mono', monospace;

  /* Espaçamento (grade base 4) */
  --s-1: 0.25rem;  --s-2: 0.5rem;   --s-3: 0.75rem;  --s-4: 1rem;
  --s-5: 1.5rem;   --s-6: 2rem;     --s-7: 3rem;     --s-8: 4rem;

  /* Raios */
  --r-sm: 6px;  --r:  10px;  --r-lg: 16px;  --r-pill: 999px;

  /* Sombras */
  --shadow-1: 0 1px 2px rgba(0,0,0,.3);
  --shadow-2: 0 4px 16px rgba(0,0,0,.35);
  --shadow-3: 0 16px 48px rgba(0,0,0,.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }
@media (max-width: 640px) { html { font-size: 15px; } }

body {
  font-family: var(--font-text);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
  letter-spacing: -0.011em;
  line-height: 1.5;
}

/* ━━━━━━━━━━ TIPOGRAFIA ━━━━━━━━━━ */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--text);
}

h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.875rem); }
h3 { font-size: 1.15rem; font-weight: 600; }
h4 { font-size: 0.95rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }

.eyebrow {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--text-dim);
}

.numeric {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* ━━━━━━━━━━ LAYOUT BASE ━━━━━━━━━━ */
.page-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--s-6) var(--s-5) var(--s-8);
}

@media (max-width: 640px) {
  .page-main { padding: var(--s-5) var(--s-4) var(--s-7); }
}

.page-title {
  margin-bottom: var(--s-6);
}

/* ━━━━━━━━━━ NAV ━━━━━━━━━━ */
.lucas-nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10, 14, 22, 0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.lucas-nav-inner {
  max-width: 1280px; margin: 0 auto;
  padding: var(--s-3) var(--s-5);
  display: flex; align-items: center; gap: var(--s-5);
}
.lucas-brand {
  font-family: var(--font-display);
  font-weight: 800; font-size: 1.15rem;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #f1f5f9, #94a3b8);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.lucas-nav-links {
  display: flex; gap: var(--s-1); flex: 1; flex-wrap: wrap;
}
.lucas-nav-links a {
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color .15s ease, background .15s ease;
}
.lucas-nav-links a:hover { color: var(--text); background: var(--bg-elev-2); }
.lucas-nav-links a.active { color: var(--text); background: var(--bg-elev-3); }
.lucas-nav-user {
  font-size: 0.8rem; color: var(--text-dim);
  display: flex; align-items: center; gap: var(--s-3);
}
.lucas-nav-user button {
  background: transparent; border: 1px solid var(--line);
  color: var(--text-muted);
  padding: var(--s-1) var(--s-3); border-radius: var(--r-sm);
  font-size: 0.8rem; font-weight: 500; cursor: pointer; width: auto;
}
.lucas-nav-user button:hover { background: var(--bg-elev-2); color: var(--text); }

/* ━━━━━━━━━━ LOGIN ━━━━━━━━━━ */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: var(--s-5);
  background: radial-gradient(ellipse at top, #1a2030 0%, var(--bg) 60%);
}
.login-card {
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-7) var(--s-6);
  width: 100%; max-width: 380px;
  box-shadow: var(--shadow-3);
}
.login-card h1 {
  font-size: 1.875rem; margin-bottom: var(--s-1);
  background: linear-gradient(135deg, var(--text) 0%, var(--text-muted) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.subtitle { color: var(--text-muted); margin-bottom: var(--s-6); font-size: 0.9rem; }

label { display: block; margin-bottom: var(--s-4); }
label > span {
  display: block; font-size: 0.8rem; margin-bottom: var(--s-2);
  color: var(--text-muted); font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.06em;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line-bright);
  border-radius: var(--r);
  background: var(--bg);
  color: var(--text);
  font: inherit; font-size: 0.95rem;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--info);
  background: var(--bg-elev-1);
  box-shadow: 0 0 0 3px var(--info-bg);
}
textarea { resize: vertical; min-height: 80px; }

button, .btn {
  padding: var(--s-3) var(--s-5);
  border: none;
  border-radius: var(--r);
  background: var(--text);
  color: var(--bg);
  font: inherit; font-weight: 600; font-size: 0.95rem;
  cursor: pointer;
  transition: transform .12s ease, opacity .15s, background .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
}
button:hover:not(:disabled), .btn:hover:not(:disabled) {
  background: var(--text-muted);
}
button:active:not(:disabled), .btn:active:not(:disabled) { transform: scale(0.98); }
button:disabled, .btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-secondary {
  background: var(--bg-elev-3); color: var(--text);
  border: 1px solid var(--line-bright);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-elev-2); color: var(--text);
}

.login-footer {
  margin-top: var(--s-6); text-align: center;
  font-size: 0.7rem; color: var(--text-dim);
  letter-spacing: 0.1em; text-transform: uppercase;
}

.login-card button {
  width: 100%;
  background: linear-gradient(180deg, var(--info), #0284c7);
  color: white;
  font-weight: 600;
}
.login-card button:hover:not(:disabled) {
  background: linear-gradient(180deg, #38bdf8, #0369a1);
  transform: translateY(-1px);
}

/* ━━━━━━━━━━ MENSAGENS / FLASH ━━━━━━━━━━ */
.message, .flash-msg {
  margin-top: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  font-size: 0.85rem;
  min-height: 1.25rem;
}
.message.success, .flash-msg.success { background: var(--positive-bg); color: var(--positive); }
.message.error,   .flash-msg.error   { background: var(--negative-bg); color: var(--negative); }
.flash-msg.warn { background: var(--warning-bg); color: var(--warning); }

/* ━━━━━━━━━━ HERO (a "story" do imóvel/dashboard) ━━━━━━━━━━ */
.hero {
  padding: var(--s-7) 0 var(--s-6);
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--s-6);
}
.hero-eyebrow {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--text-dim);
  margin-bottom: var(--s-3);
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 700; letter-spacing: -0.04em;
  margin-bottom: var(--s-2);
}
.hero-meta {
  color: var(--text-muted);
  font-size: 0.95rem;
  display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-5);
  align-items: baseline;
}

/* HERO STAT — números gigantes que contam a história */
.hero-stats {
  display: grid; gap: var(--s-5);
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-top: var(--s-6);
}
.hero-stat .label {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-dim);
  margin-bottom: var(--s-2);
}
.hero-stat .value {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1;
  color: var(--text);
}
.hero-stat .value.pos { color: var(--positive); }
.hero-stat .value.neg { color: var(--negative); }
.hero-stat .value.gold { color: var(--gold); }
.hero-stat .sub {
  font-size: 0.8rem; color: var(--text-muted);
  margin-top: var(--s-2);
}

/* ━━━━━━━━━━ CARDS / SECTIONS ━━━━━━━━━━ */
.section {
  margin-bottom: var(--s-7);
}
.section-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: var(--s-4); gap: var(--s-3);
}
.section-title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.015em;
}
.section-sub {
  font-size: 0.8rem; color: var(--text-muted);
}

.card {
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  transition: border-color .15s ease;
}
.card:hover { border-color: var(--line-bright); }

.card-pad-lg { padding: var(--s-6); }

/* Variants */
.card-positive  { border-left: 3px solid var(--positive); }
.card-warning   { border-left: 3px solid var(--warning); }
.card-negative  { border-left: 3px solid var(--negative); }
.card-info      { border-left: 3px solid var(--info); }
.card-gold      { border-left: 3px solid var(--gold); }

/* Compat com classes antigas */
.form-card, .list-card, .property-header {
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  margin-bottom: var(--s-5);
}

.list-card-header {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s-3); margin-bottom: var(--s-4);
}
.list-card-header h3 { margin: 0; }

/* ━━━━━━━━━━ STATS GRID (cards menores, secundários) ━━━━━━━━━━ */
.stats-grid {
  display: grid; gap: var(--s-4);
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.stat {
  display: flex; flex-direction: column; gap: var(--s-1);
}
.stat .stat-label {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-dim);
}
.stat .stat-value {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-size: 1.5rem; font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.1;
  color: var(--text);
}
.stat .stat-sub {
  font-size: 0.75rem; color: var(--text-muted);
}
.stat .stat-value.pos  { color: var(--positive); }
.stat .stat-value.neg  { color: var(--negative); }
.stat .stat-value.gold { color: var(--gold); }
.stat .stat-value.info { color: var(--info); }

/* Compat: grid-meta antiga (do property-header) */
.grid-meta {
  display: grid; gap: var(--s-4);
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin-top: var(--s-5);
  padding-top: var(--s-5);
  border-top: 1px solid var(--line);
}
.grid-meta > div { display: flex; flex-direction: column; gap: var(--s-1); }
.grid-meta small {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-dim);
  display: block;
}
.grid-meta strong {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-size: 1.25rem; font-weight: 700;
  letter-spacing: -0.015em;
}
.grid-meta .amount-pos { color: var(--positive); }
.grid-meta .amount-neg { color: var(--negative); }

/* ━━━━━━━━━━ TABELAS ━━━━━━━━━━ */
table {
  width: 100%; border-collapse: collapse;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}
thead tr {
  border-bottom: 1px solid var(--line-bright);
}
th {
  text-align: left; padding: var(--s-3) var(--s-2);
  font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-dim);
}
td {
  padding: var(--s-3) var(--s-2);
  border-bottom: 1px solid var(--line);
  color: var(--text);
}
tbody tr:hover td { background: var(--bg-elev-2); }
tbody tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.amount-pos { color: var(--positive); }
.amount-neg { color: var(--negative); }

/* ━━━━━━━━━━ BADGES ━━━━━━━━━━ */
.badge {
  display: inline-flex; align-items: center; gap: var(--s-1);
  padding: var(--s-1) var(--s-3);
  background: var(--bg-elev-3);
  border-radius: var(--r-pill);
  font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-transform: uppercase;
}
.badge.ok    { background: var(--positive-bg); color: var(--positive); }
.badge.warn  { background: var(--warning-bg);  color: var(--warning); }
.badge.error { background: var(--negative-bg); color: var(--negative); }
.badge.info  { background: var(--info-bg);     color: var(--info); }

/* ━━━━━━━━━━ EMPTY STATES ━━━━━━━━━━ */
.empty-state {
  padding: var(--s-7) var(--s-5);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  border: 1px dashed var(--line-bright);
  border-radius: var(--r-lg);
  background: var(--bg-elev-1);
}

/* ━━━━━━━━━━ FORM ━━━━━━━━━━ */
.form-grid {
  display: grid; gap: var(--s-4);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.form-actions {
  display: flex; gap: var(--s-3); align-items: center;
  margin-top: var(--s-5); flex-wrap: wrap;
}
.form-actions button { width: auto; }

.list-filters {
  display: flex; gap: var(--s-3); flex-wrap: wrap;
  margin-bottom: var(--s-4); align-items: end;
}
.list-filters label { margin: 0; flex: 1; min-width: 150px; }
.list-filters button { width: auto; }

/* ━━━━━━━━━━ HEATMAP / DATA VIZ ━━━━━━━━━━ */
.heatmap-grid {
  display: grid; gap: 2px;
  grid-template-columns: 36px repeat(31, 1fr);
  font-size: 0.65rem;
}
.heatmap-cell {
  height: 14px; border-radius: 2px;
  background: var(--bg-elev-3);
  cursor: default;
}
.heatmap-cell.occupied { cursor: pointer; }
.heatmap-cell:hover.occupied { transform: scale(1.3); transition: transform .12s ease; }

/* ━━━━━━━━━━ UTILITIES ━━━━━━━━━━ */
.muted { color: var(--text-muted); }
.dim   { color: var(--text-dim); }
.mono  { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.flex  { display: flex; gap: var(--s-3); align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); }
.gap-2 { gap: var(--s-2); }
.gap-3 { gap: var(--s-3); }
.mt-3 { margin-top: var(--s-3); }
.mt-5 { margin-top: var(--s-5); }
.mb-3 { margin-bottom: var(--s-3); }
.mb-5 { margin-bottom: var(--s-5); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.divider {
  height: 1px; background: var(--line);
  margin: var(--s-5) 0;
}

/* ━━━━━━━━━━ ANIMAÇÕES ━━━━━━━━━━ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn .35s ease-out both; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .35; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg-elev-2) 0%, var(--bg-elev-3) 50%, var(--bg-elev-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite ease-in-out;
  border-radius: var(--r-sm);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ━━━━━━━━━━ PROGRESS BAR ━━━━━━━━━━ */
.progress-card {
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  margin-top: var(--s-5);
  display: none;
}
.progress-card.show { display: block; animation: fadeIn .25s ease-out; }
.progress-step {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-2) 0;
  color: var(--text-dim);
  font-size: 0.875rem;
}
.progress-step.active { color: var(--info); }
.progress-step.done   { color: var(--positive); }
.progress-step.error  { color: var(--negative); }
.progress-step .dot {
  width: 0.75rem; height: 0.75rem;
  border-radius: 50%; background: currentColor;
  opacity: .35;
}
.progress-step.active .dot { opacity: 1; animation: pulse 1.5s ease-in-out infinite; }
.progress-step.done .dot, .progress-step.error .dot { opacity: 1; }

.extraction-result {
  margin-top: var(--s-4);
  padding: var(--s-4);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: pre-wrap;
  max-height: 320px;
  overflow-y: auto;
}

/* Scroll bar custom (webkit) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg-elev-3); border-radius: var(--r-pill); border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--line-bright); }

/* ━━━━━━━━━━ UPLOAD ZONE ━━━━━━━━━━ */
.upload-zone {
  border: 1.5px dashed var(--line-bright);
  border-radius: var(--r-lg);
  padding: var(--s-7) var(--s-5);
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--info);
  background: var(--info-bg);
}
.upload-zone .icon { font-size: 2.5rem; margin-bottom: var(--s-3); opacity: .6; }
.upload-zone .hint { color: var(--text-muted); font-size: 0.85rem; margin-top: var(--s-2); }

/* Button variant: vision/specific */
.btn-vision {
  padding: var(--s-1) var(--s-3);
  font-size: 0.72rem;
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-weight: 600;
  width: auto;
}
.btn-vision:hover { background: var(--info); color: var(--bg); }

.sub-metric { font-size: 0.85rem; color: var(--text-muted); }

/* Compat antigos (cards container) */
.cards {
  display: grid; gap: var(--s-4);
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: var(--s-5);
}
.cards .card .metric {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-size: 1.625rem; font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.1;
  margin: var(--s-2) 0 var(--s-1);
}

/* Responsive helpers */
@media (max-width: 640px) {
  .hero h1 { font-size: 2rem; }
  .hero-stat .value { font-size: 1.625rem; }
  .stats-grid, .grid-meta { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .hero { padding-top: var(--s-5); padding-bottom: var(--s-4); }
  th, td { padding: var(--s-2); }
  table { font-size: 0.8rem; }
}

/* Login simplificado e centralizado */
.login-card .login-footer { margin-top: var(--s-5); }
