/* LeadEngine demo – components. Tokens live in tokens.css */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--le-font); color: var(--le-ink); background: var(--le-bg); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--le-green-700); }
a:hover { color: var(--le-green-900); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--le-muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid rgba(47,125,50,.45); outline-offset: 2px; }

/* ---------- Logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; direction: ltr; text-decoration: none; color: var(--le-ink); }
.logo img { display: block; }
.logo-word { font-weight: 700; letter-spacing: -0.5px; font-size: 21px; }
.logo-word b { color: var(--le-green-700); font-weight: 700; }

/* ---------- Buttons & fields ---------- */
.btn { height: var(--le-control-h); padding: 0 16px; border-radius: var(--le-radius); border: 1px solid var(--le-border-in); background: var(--le-surface); color: var(--le-ink); font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #F2F5F1; color: var(--le-ink); }
.btn-primary { background: var(--le-green-700); border-color: var(--le-green-700); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--le-green-800); color: #fff; }
.btn-soft { background: var(--le-green-50); border-color: var(--le-green-50); color: var(--le-green-900); font-weight: 600; }
.btn-soft:hover { background: #D6EDD8; color: var(--le-green-900); }
.btn-danger { background: var(--le-danger); border-color: var(--le-danger); color: #fff; font-weight: 600; }
.btn-danger-outline { color: var(--le-danger); border-color: #F3C1BC; font-weight: 600; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-lg { height: var(--le-control-h-lg); font-size: 16px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: default; }
.icon-btn { width: 40px; height: 40px; border-radius: var(--le-radius-sm); border: 0; background: transparent; display: inline-flex; align-items: center; justify-content: center; color: var(--le-ink); cursor: pointer; }
.icon-btn:hover { background: #EEF3EE; color: var(--le-ink); }
.icon-btn.wa { color: #1E8E3E; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .label { font-size: 13px; font-weight: 500; color: var(--le-ink-2); }
.input, .select, .textarea { width: 100%; height: var(--le-control-h); padding: 0 14px; border: 1px solid var(--le-border-in); border-radius: var(--le-radius); background: var(--le-surface); font-size: 16px; }
.textarea { height: auto; padding: 12px 14px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--le-green-700); box-shadow: var(--le-focus); }
.input-lg { height: var(--le-control-h-lg); }
.input.ltr { text-align: right; }
.input-icon { position: relative; }
.input-icon svg { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--le-muted); pointer-events: none; }
.input-icon .input { padding-right: 42px; }
.req { color: var(--le-danger); }
.field-error { font-size: 13px; color: var(--le-danger); }

/* ---------- Cards, chips ---------- */
.card { background: var(--le-surface); border: 1px solid var(--le-border); border-radius: var(--le-radius-lg); }
.card-pad { padding: 24px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: var(--le-radius-pill); font-size: 13px; font-weight: 600; white-space: nowrap; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px; background: #F2F4F1; font-size: 13px; color: var(--le-ink-2); white-space: nowrap; }
.chip { flex: none; height: 36px; padding: 0 14px; border-radius: var(--le-radius-pill); border: 1px solid var(--le-border-in); background: var(--le-surface); font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.chip:hover { border-color: var(--le-green-700); }
.chip[aria-pressed="true"] { background: var(--le-ink); border-color: var(--le-ink); color: #fff; }
.chip small { font-size: 12px; opacity: .75; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #1D4ED8; display: inline-block; flex: none; }
.status-select { height: 34px; padding: 0 10px; border: 0; border-radius: var(--le-radius-pill); font-size: 13px; font-weight: 600; cursor: pointer; }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; display: flex; }
.side { flex: 0 0 var(--le-sidebar-w); background: var(--le-surface); border-left: 1px solid var(--le-border); padding: 24px 16px; display: flex; flex-direction: column; gap: 28px; position: sticky; top: 0; height: 100vh; }
.side .logo { padding: 0 8px; justify-content: flex-end; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { height: 44px; padding: 0 14px; border-radius: var(--le-radius-sm); display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 500; color: var(--le-ink-2); text-decoration: none; }
.nav a:hover { background: #EEF3EE; color: var(--le-ink); }
.nav a[aria-current="page"] { background: var(--le-green-50); color: var(--le-green-900); font-weight: 600; }
.nav .badge { margin-inline-start: auto; min-width: 24px; height: 22px; padding: 0 6px; border-radius: var(--le-radius-pill); background: var(--le-green-700); color: #fff; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.side-user { padding: 12px; border-radius: var(--le-radius); background: var(--le-bg); }
.side-user b { display: block; font-size: 14px; font-weight: 600; }
.side-user span { font-size: 12px; color: var(--le-muted); }
.main { flex: 1; min-width: 0; padding: 32px 40px 48px; display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-end; }
.page-head h1 { font-size: var(--le-fs-h1); font-weight: 700; }
.page-head p { margin: 4px 0 0; color: var(--le-muted); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.topbar, .tabbar { display: none; }

/* ---------- Leads ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.kpi span { font-size: 13px; color: var(--le-muted); }
.kpi b { font-size: 30px; font-weight: 700; line-height: 1.1; }
.filters { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filter-row .grow { flex: 3 1 260px; }
.filter-row .date { flex: 1 1 150px; }
.adv { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; padding-top: 14px; border-top: 1px solid #EEF0EE; }
.bulk { background: var(--le-forest); color: #fff; border-radius: 14px; padding: 10px 16px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.bulk .select { width: auto; height: 40px; color: var(--le-ink); }
.bulk .btn { height: 40px; background: transparent; color: #fff; border-color: #3D6B44; margin-inline-start: auto; }

.table-wrap { overflow-x: auto; }
table.leads { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 980px; }
table.leads th { background: #F8FAF7; color: var(--le-muted); font-weight: 500; text-align: right; padding: 12px 8px; }
table.leads td { padding: 12px 8px; border-top: 1px solid #EEF0EE; vertical-align: middle; }
table.leads th:first-child, table.leads td:first-child { padding-right: 16px; width: 44px; }
table.leads th:last-child, table.leads td:last-child { padding-left: 16px; text-align: left; }
table.leads tbody tr:hover { background: #FAFBF9; }
table.leads tr.is-selected { background: #F3F9F3; }
.cell-main { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.cell-sub { font-size: 12px; color: var(--le-muted); margin-top: 2px; }
.row-actions { display: inline-flex; gap: 4px; }
.check { width: 18px; height: 18px; accent-color: var(--le-green-700); }
.empty { padding: 48px 16px; text-align: center; color: var(--le-muted); }
.cards { display: none; flex-direction: column; gap: 12px; }
.lead-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.lead-card .top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.lead-card .name { font-size: 17px; font-weight: 600; color: var(--le-ink); text-decoration: none; display: flex; align-items: center; gap: 6px; }
.lead-card .meta { display: flex; flex-wrap: wrap; gap: 8px; }
.lead-card .cta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.skeleton { background: linear-gradient(90deg, #EEF0EE 25%, #F6F7F5 50%, #EEF0EE 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; height: 18px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- Lead detail ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; text-decoration: none; }
.detail { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.detail > .col-main { flex: 2 1 460px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.detail > .col-side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.contact-cta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.contact-cta .btn { height: 56px; font-size: 15px; }
.status-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.status-opt { height: 40px; padding: 0 14px; border-radius: var(--le-radius-pill); border: 1.5px solid var(--le-border-in); background: var(--le-surface); font-size: 14px; font-weight: 500; cursor: pointer; }
dl.facts { margin: 0; }
dl.facts > div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid #EEF0EE; }
dl.facts > div:last-child { border-bottom: 0; }
dl.facts dt { color: var(--le-muted); font-size: 14px; }
dl.facts dd { margin: 0; font-weight: 500; text-align: left; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.timeline li { display: flex; gap: 12px; }
.timeline li::before { content: ""; flex: none; width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; background: var(--le-lime); }
.timeline time { display: block; font-size: 12px; color: var(--le-muted); }

/* ---------- Forms layouts ---------- */
.two-col { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.two-col > .wide { flex: 2 1 420px; min-width: 0; }
.two-col > .narrow { flex: 1 1 300px; min-width: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.banner { border-radius: 14px; padding: 14px 16px; display: flex; align-items: center; gap: 10px; font-weight: 500; }
.banner-ok { background: var(--le-green-50); border: 1px solid #BFE0C2; color: var(--le-green-900); }
.banner-err { background: var(--le-danger-50); border: 1px solid #F3C1BC; color: var(--le-danger); }
.result-box { border-radius: var(--le-radius); background: var(--le-bg); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--le-border); }
.tab { height: 44px; padding: 0 18px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--le-muted); font-weight: 600; cursor: pointer; }
.tab[aria-selected="true"] { color: var(--le-green-900); border-bottom-color: var(--le-green-700); }
.strength { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.strength i { height: 5px; border-radius: 3px; background: var(--le-border); }
.avatar { width: 52px; height: 52px; border-radius: 14px; background: var(--le-green-50); color: var(--le-green-900); display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; flex: none; }
dl.grid-facts { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px 24px; }
dl.grid-facts dt { font-size: 13px; color: var(--le-muted); margin-bottom: 4px; }
dl.grid-facts dd { margin: 0; font-weight: 500; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: flex; flex-wrap: wrap; }
.login-brand { flex: 1 1 480px; background: var(--le-forest); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.login-brand h1 { font-size: 44px; line-height: 1.15; font-weight: 700; max-width: 460px; }
.login-brand p { color: #CFE3D1; font-size: 17px; line-height: 1.6; max-width: 460px; }
.login-brand ul { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.login-brand li { display: flex; gap: 10px; align-items: center; }
.login-brand .logo { color: #fff; justify-content: flex-end; }
.login-brand .logo-word b { color: #8FD993; }
.login-form-wrap { flex: 1 1 520px; display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.login-form { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 20px; }
.login-form h2 { font-size: 30px; font-weight: 700; }
.login-mobile-logo { display: none; justify-content: center; }
.pass-wrap { position: relative; }
.pass-wrap .input { padding-left: 52px; }
.pass-wrap button { position: absolute; left: 2px; top: 2px; }
.demo-hint { font-size: 13px; color: var(--le-muted); text-align: center; background: #fff; border: 1px dashed var(--le-border-in); border-radius: var(--le-radius); padding: 10px; }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--le-ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 500; opacity: 0; transition: .2s; z-index: 50; pointer-events: none; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--le-danger); }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  .side { display: none; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 10; background: var(--le-surface); border-bottom: 1px solid var(--le-border); padding: 10px 16px; align-items: center; justify-content: space-between; }
  .topbar .logo-word { font-size: 18px; }
  .tabbar { display: grid; position: fixed; bottom: 0; right: 0; left: 0; z-index: 10; height: calc(68px + env(safe-area-inset-bottom)); padding: 0 6px env(safe-area-inset-bottom); background: var(--le-surface); border-top: 1px solid var(--le-border); grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 48px; font-size: 11px; font-weight: 500; color: var(--le-muted); text-decoration: none; }
  .tabbar a[aria-current="page"] { color: var(--le-green-900); }
  .tabbar a.fab { justify-self: center; width: 56px; height: 56px; margin-top: -24px; border-radius: 18px; background: var(--le-green-700); color: #fff; box-shadow: 0 6px 16px rgba(47,125,50,.35); }
  .shell { flex-direction: column; }
  .main { padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); gap: 16px; }
  .page-head h1 { font-size: 24px; }
  .page-head .actions .btn-primary { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi b { font-size: 24px; }
  .table-wrap { display: none; }
  .cards { display: flex; }
  .card-pad { padding: 18px; }
  .login-brand { display: none; }
  .login-mobile-logo { display: flex; }
  .toast { bottom: calc(88px + env(safe-area-inset-bottom)); }
  .contact-cta .btn { flex-direction: column; gap: 4px; height: 64px; font-size: 13px; }
}
