/* ============ AMARO CRM ============ */
:root {
  --bg: #0E0F12;
  --bg-2: #15171B;
  --bg-3: #1C1F24;
  --bg-4: #252931;
  --border: #2A2E36;
  --border-soft: #1F2228;
  --gold: #C4A572;
  --gold-soft: rgba(196,165,114,0.15);
  --text: #E8E4DC;
  --text-2: #A4A199;
  --text-3: #6A6A6A;
  --green: #22C55E;
  --green-soft: rgba(34,197,94,0.15);
  --orange: #F59E0B;
  --orange-soft: rgba(245,158,11,0.15);
  --blue: #3B82F6;
  --blue-soft: rgba(59,130,246,0.15);
  --red: #EF4444;
  --red-soft: rgba(239,68,68,0.15);
  --purple: #A855F7;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Inter", -apple-system, sans-serif;
}
* { margin:0; padding:0; box-sizing:border-box; }
html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 14px; -webkit-font-smoothing: antialiased; }

/* Force lining figures (uniform-height numbers) in all serif displays. */
.stat-card__value, .score-num, .card__title, .topbar h1,
.detail-header h2, .sidebar__logo-main, .login-hero__logo,
.loc-stat__num, .kb-card__top span, .info-item__value {
  font-variant-numeric: lining-nums tabular-nums;
  font-feature-settings: "lnum" 1, "tnum" 1;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #323842; }

/* ============ LOGIN ============ */
.login-shell {
  min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr;
  background: var(--bg);
}
.login-hero {
  background: linear-gradient(135deg, #1A1B1F 0%, #0A0B0D 100%);
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; padding: 60px;
}
.login-hero::before {
  content: ''; position: absolute; inset: 0;
  background: url('https://images.unsplash.com/photo-1545324418-cc1a3fa10c00?w=1200&q=80') center/cover;
  opacity: 0.18;
}
.login-hero__content { position: relative; z-index: 2; text-align: center; color: #fff; }
.login-hero__logo { font-family: var(--serif); font-size: 72px; letter-spacing: 14px; font-weight: 300; margin-bottom: 4px; }
.login-hero__sub { font-size: 10px; letter-spacing: 8px; color: var(--gold); margin-bottom: 40px; }
.login-hero__divider { width: 48px; height: 1px; background: var(--gold); margin: 0 auto 40px; }
.login-hero__quote { font-family: var(--serif); font-style: italic; font-size: 24px; color: #D4CEC0; max-width: 400px; margin: 0 auto; line-height: 1.5; }
.login-hero__role { font-size: 11px; letter-spacing: 3px; color: var(--gold); margin-top: 32px; }

.login-form-wrap { display: flex; align-items: center; justify-content: center; padding: 60px; }
.login-form { width: 100%; max-width: 400px; }
.login-form h1 { font-family: var(--serif); font-size: 40px; font-weight: 400; margin-bottom: 10px; }
.login-form p { color: var(--text-2); margin-bottom: 40px; }
.login-form .field { margin-bottom: 20px; }
.login-form label { font-size: 11px; letter-spacing: 2px; color: var(--text-2); text-transform: uppercase; margin-bottom: 8px; display: block; }
.login-form input {
  width: 100%; padding: 16px 18px; background: var(--bg-2); border: 1px solid var(--border);
  color: var(--text); font-size: 14px; border-radius: 4px; font-family: inherit; transition: all .2s;
}
.login-form input:focus { outline: none; border-color: var(--gold); background: var(--bg-3); }
.login-form .btn-submit {
  width: 100%; padding: 16px; background: var(--gold); color: #111;
  border: none; font-weight: 600; font-size: 12px; letter-spacing: 3px; text-transform: uppercase;
  border-radius: 4px; margin-top: 8px; transition: all .2s;
}
.login-form .btn-submit:hover { background: #D9BE8C; transform: translateY(-1px); }
.login-form .err { background: var(--red-soft); color: #FCA5A5; padding: 12px 16px; border-radius: 4px; font-size: 13px; margin-bottom: 20px; border: 1px solid rgba(239,68,68,0.25); }
.login-form .hint { margin-top: 24px; padding: 16px; background: var(--bg-2); border-radius: 4px; font-size: 12px; color: var(--text-2); border-left: 2px solid var(--gold); }
.login-form .hint code { color: var(--gold); background: rgba(196,165,114,0.08); padding: 2px 6px; border-radius: 3px; font-family: monospace; }

/* ============ APP SHELL ============ */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }

.sidebar { background: var(--bg-2); border-right: 1px solid var(--border); padding: 24px 0; display: flex; flex-direction: column; }
.sidebar__logo { padding: 0 24px 32px; border-bottom: 1px solid var(--border); }
.sidebar__logo-main { font-family: var(--serif); font-size: 24px; letter-spacing: 6px; font-weight: 400; }
.sidebar__logo-sub { font-size: 9px; letter-spacing: 3px; color: var(--gold); margin-top: 2px; }

.nav-list { padding: 16px 12px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  color: var(--text-2); font-size: 13px; border-radius: 6px; transition: all .2s; margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg-3); color: var(--text); }
.nav-item.active { background: var(--gold-soft); color: var(--gold); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar__user { padding: 16px 24px; border-top: 1px solid var(--border); }
.user-block { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--gold); color: #111; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; flex-shrink: 0; }
.user-info { font-size: 12px; line-height: 1.3; min-width: 0; }
.user-info strong { color: var(--text); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info span { color: var(--text-3); font-size: 10px; }
.logout-link { font-size: 11px; color: var(--text-3); padding: 6px 0; display: inline-block; }
.logout-link:hover { color: var(--gold); }

/* ============ MAIN ============ */
.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  padding: 20px 36px; background: rgba(14,15,18,0.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.topbar h1 { font-family: var(--serif); font-size: 28px; font-weight: 400; }
.topbar .actions { display: flex; gap: 10px; align-items: center; }

.search {
  padding: 10px 14px 10px 36px; background: var(--bg-2); border: 1px solid var(--border);
  color: var(--text); font-size: 13px; border-radius: 6px; min-width: 280px; font-family: inherit;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%236A6A6A' viewBox='0 0 16 16'><path d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/></svg>");
  background-repeat: no-repeat; background-position: 12px center;
}
.search:focus { outline: none; border-color: var(--gold); }

.page { padding: 32px 36px; }

/* ============ STATS ============ */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px; }
.stat-card {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 20px 22px;
  transition: all .2s;
}
.stat-card:hover { border-color: var(--gold); }
.stat-card__top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.stat-card__title { font-size: 11px; letter-spacing: 2px; color: var(--text-3); text-transform: uppercase; }
.stat-card__icon {
  width: 32px; height: 32px; border-radius: 8px; background: var(--gold-soft); color: var(--gold);
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.stat-card__icon.green { background: var(--green-soft); color: var(--green); }
.stat-card__icon.orange { background: var(--orange-soft); color: var(--orange); }
.stat-card__icon.blue { background: var(--blue-soft); color: var(--blue); }
.stat-card__value { font-family: var(--serif); font-size: 36px; font-weight: 400; line-height: 1; margin-bottom: 6px; }
.stat-card__sub { font-size: 11px; color: var(--text-3); }
.stat-card__trend { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--green); font-weight: 500; }
.stat-card__trend.down { color: var(--red); }

/* ============ CARDS ============ */
.card {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
}
.card__header {
  padding: 18px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card__title { font-family: var(--serif); font-size: 18px; font-weight: 400; }
.card__body { padding: 24px; }

.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }

/* ============ SCORE BADGE ============ */
.score-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.5px; }
.score-badge.quente { background: var(--red-soft); color: #FCA5A5; }
.score-badge.morno { background: var(--orange-soft); color: #FBBF24; }
.score-badge.frio { background: var(--blue-soft); color: #93C5FD; }
.score-badge.quente::before { content: '🔥'; }
.score-badge.morno::before { content: '✨'; }
.score-badge.frio::before { content: '❄️'; }

.score-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%; font-weight: 700; font-size: 13px; font-family: var(--serif);
  color: var(--text);
}
.score-num.quente { background: linear-gradient(135deg, #EF4444, #991B1B); color: #fff; }
.score-num.morno { background: linear-gradient(135deg, #F59E0B, #B45309); color: #fff; }
.score-num.frio { background: linear-gradient(135deg, #3B82F6, #1E40AF); color: #fff; }

/* ============ TABLE ============ */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: 14px 20px; font-size: 10px; letter-spacing: 2px; color: var(--text-3); text-transform: uppercase; border-bottom: 1px solid var(--border); font-weight: 500; background: var(--bg-3); }
.table td { padding: 16px 20px; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: var(--bg-3); }
.table tbody tr:last-child td { border-bottom: none; }
.table td .lead-name { font-weight: 500; color: var(--text); display: block; }
.table td .lead-meta { font-size: 11px; color: var(--text-3); }
.table td a { color: var(--gold); }

/* ============ STATUS PILL ============ */
.pill { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; font-weight: 600; border: 1px solid; }
.pill.novo { background: var(--blue-soft); color: #93C5FD; border-color: rgba(59,130,246,0.3); }
.pill.contato { background: var(--orange-soft); color: #FBBF24; border-color: rgba(245,158,11,0.3); }
.pill.qualificado { background: rgba(168,85,247,0.15); color: #D8B4FE; border-color: rgba(168,85,247,0.3); }
.pill.visita { background: rgba(236,72,153,0.15); color: #F9A8D4; border-color: rgba(236,72,153,0.3); }
.pill.proposta { background: var(--gold-soft); color: var(--gold); border-color: rgba(196,165,114,0.3); }
.pill.fechado { background: var(--green-soft); color: #86EFAC; border-color: rgba(34,197,94,0.3); }
.pill.perdido { background: var(--red-soft); color: #FCA5A5; border-color: rgba(239,68,68,0.3); }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px;
  background: var(--bg-3); color: var(--text); border: 1px solid var(--border); border-radius: 6px;
  font-size: 12px; font-weight: 500; transition: all .2s;
}
.btn:hover { background: var(--bg-4); border-color: var(--gold); }
.btn-primary { background: var(--gold); color: #111; border-color: var(--gold); font-weight: 600; }
.btn-primary:hover { background: #D9BE8C; color: #111; border-color: #D9BE8C; }
.btn-wa { background: #25D366; color: #fff; border-color: #25D366; }
.btn-wa:hover { background: #1FAA54; border-color: #1FAA54; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 11px; }

/* ============ FILTERS ============ */
.filter-row { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-row select, .filter-row input {
  padding: 10px 14px; background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; font-size: 13px; font-family: inherit;
}
.filter-row select:focus, .filter-row input:focus { outline: none; border-color: var(--gold); }

/* ============ KANBAN ============ */
.kanban { display: grid; grid-template-columns: repeat(7, minmax(260px, 1fr)); gap: 16px; overflow-x: auto; padding-bottom: 20px; }
.kb-col { background: var(--bg-2); border-radius: 10px; border: 1px solid var(--border); min-height: 400px; display: flex; flex-direction: column; }
.kb-col__head { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.kb-col__title { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; font-weight: 600; }
.kb-col__count { font-size: 11px; color: var(--text-3); background: var(--bg-4); padding: 2px 8px; border-radius: 10px; }
.kb-col__body { padding: 10px; flex: 1; overflow-y: auto; max-height: 70vh; }
.kb-card {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: 8px; padding: 14px;
  margin-bottom: 10px; cursor: grab; transition: all .2s;
}
.kb-card:hover { border-color: var(--gold); transform: translateY(-1px); }
.kb-card.dragging { opacity: 0.4; cursor: grabbing; }
.kb-col__body.drop-hover { background: var(--gold-soft); border-radius: 8px; }
.kb-card__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; gap: 8px; }
.kb-card__name { font-weight: 600; font-size: 14px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-card__meta { font-size: 11px; color: var(--text-3); margin-bottom: 10px; line-height: 1.5; }
.kb-card__meta strong { color: var(--text-2); font-weight: 500; }
.kb-card__foot { display: flex; justify-content: space-between; align-items: center; font-size: 10px; color: var(--text-3); }

/* Pill colors in kb-col */
.kb-col.novo .kb-col__title { color: #93C5FD; }
.kb-col.contato .kb-col__title { color: #FBBF24; }
.kb-col.qualificado .kb-col__title { color: #D8B4FE; }
.kb-col.visita .kb-col__title { color: #F9A8D4; }
.kb-col.proposta .kb-col__title { color: var(--gold); }
.kb-col.fechado .kb-col__title { color: #86EFAC; }
.kb-col.perdido .kb-col__title { color: #FCA5A5; }

/* ============ LEAD DETAIL ============ */
.lead-detail { display: grid; grid-template-columns: 1fr 380px; gap: 24px; }
.detail-header {
  background: linear-gradient(135deg, var(--bg-2) 0%, var(--bg-3) 100%);
  padding: 32px; border-radius: 12px; border: 1px solid var(--border); margin-bottom: 24px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}
.detail-header__left { display: flex; gap: 20px; align-items: center; }
.detail-header h2 { font-family: var(--serif); font-size: 34px; font-weight: 400; margin-bottom: 6px; }
.detail-header__contact { color: var(--text-2); font-size: 13px; }
.detail-header__contact a { color: var(--gold); }

.info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.info-item { background: var(--bg-3); padding: 14px 16px; border-radius: 8px; border-left: 2px solid var(--gold); }
.info-item__label { font-size: 10px; letter-spacing: 2px; color: var(--text-3); text-transform: uppercase; margin-bottom: 4px; }
.info-item__value { font-size: 14px; color: var(--text); font-weight: 500; }

/* ============ TIMELINE ============ */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 1px; background: var(--border); }
.timeline__item { position: relative; margin-bottom: 20px; }
.timeline__dot {
  position: absolute; left: -28px; top: 4px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--bg-3); border: 2px solid var(--gold); display: flex; align-items: center; justify-content: center;
}
.timeline__dot::after { content: ''; width: 6px; height: 6px; background: var(--gold); border-radius: 50%; }
.timeline__body { background: var(--bg-3); padding: 12px 16px; border-radius: 8px; }
.timeline__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.timeline__type { font-size: 10px; letter-spacing: 2px; color: var(--gold); text-transform: uppercase; font-weight: 600; }
.timeline__time { font-size: 11px; color: var(--text-3); }
.timeline__desc { font-size: 13px; color: var(--text); line-height: 1.5; }
.timeline__author { font-size: 11px; color: var(--text-3); margin-top: 4px; }

.note-form textarea {
  width: 100%; padding: 14px; background: var(--bg-3); border: 1px solid var(--border);
  color: var(--text); font-family: inherit; font-size: 13px; border-radius: 6px; resize: vertical; min-height: 80px;
}
.note-form textarea:focus { outline: none; border-color: var(--gold); }

/* ============ CHART ============ */
.chart-wrap { padding: 8px 4px; }

/* ============ RESPONSIVE ============ */
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .lead-detail { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .kanban { grid-template-columns: repeat(1, 1fr); }
}
