/* Agent Lead Dashboard — BrokerDesk. Namespaced .al */
* { box-sizing: border-box; } body { margin: 0; }
.al {
    --bg: #f4f7fb; --panel: #fff; --panel2: #f3f6fb; --line: #e3e9f2; --ink: #0f172a; --muted: #64748b;
    --brand: #2563eb; --brand-ink: #1d4ed8; --accent: #7c3aed;
    --ok: #16a34a; --warn: #d97706; --danger: #dc2626;
    --shadow: 0 12px 32px -18px rgba(37,99,235,.28);
    min-height: calc(100vh - 44px); font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
    background: radial-gradient(1000px 420px at 88% -10%, rgba(37,99,235,.06), transparent), var(--bg); color: var(--ink);
}
.al-btn { border: 0; cursor: pointer; border-radius: .6rem; padding: .6rem 1rem; font: 700 .86rem inherit; background: var(--brand); color: #fff; transition: transform .1s; white-space: nowrap; }
.al-btn:hover { transform: translateY(-1px); } .al-btn.ghost { background: var(--panel); color: var(--ink); border: 1px solid var(--line); }
.al-btn.sm { padding: .4rem .75rem; font-size: .8rem; } .al-btn.danger { background: var(--danger); }
.al-h2 { margin: 0; font-size: 1.25rem; }
.al-topbar { display: flex; align-items: center; gap: 1rem; padding: .8rem 1.5rem; background: var(--panel); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; flex-wrap: wrap; }
.al-brand { display: flex; align-items: center; gap: .6rem; } .al-logo { font-size: 1.6rem; }
.al-brand b { display: block; font-size: 1.05rem; } .al-brand small { color: var(--muted); font-size: .72rem; }
.al-nav { display: flex; gap: .25rem; margin: 0 auto; flex-wrap: wrap; }
.al-navbtn { border: 0; background: transparent; color: var(--muted); padding: .5rem .8rem; border-radius: .6rem; font: 600 .85rem inherit; cursor: pointer; display: inline-flex; gap: .4rem; align-items: center; }
.al-navbtn:hover { color: var(--ink); background: var(--panel2); } .al-navbtn.active { background: var(--brand); color: #fff; }
.al-badge { background: rgba(0,0,0,.12); border-radius: 999px; padding: 0 .4rem; font-size: .7rem; min-width: 1.1rem; text-align: center; }
.al-top-actions { display: flex; align-items: center; gap: .6rem; }
.al-live-dot { color: var(--ok); font-size: .72rem; font-weight: 800; letter-spacing: .1em; display: inline-flex; align-items: center; gap: .4rem; }
.al-live-dot::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: var(--ok); animation: alp 1.3s infinite; }
@keyframes alp { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
.al-view { max-width: 1240px; margin: 0 auto; padding: 1.5rem; } .al-view[hidden] { display: none !important; }
.al-card { background: var(--panel); border: 1px solid var(--line); border-radius: 1rem; padding: 1.3rem; box-shadow: var(--shadow); }
.al-card h3 { margin: 0 0 1rem; font-size: .95rem; }

/* INBOX */
.al-inbox-head, .al-pipe-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.al-inbox-head h2, .al-pipe-head h2 { margin: 0; }
.al-inbox-stats, .al-pipe-stats { display: flex; gap: 1.5rem; }
.al-inbox-stats .s b, .al-pipe-stats .s b { font-size: 1.3rem; font-weight: 800; display: block; }
.al-inbox-stats .s small, .al-pipe-stats .s small { color: var(--muted); font-size: .72rem; }
.al-inbox-row { background: var(--panel); border: 1px solid var(--line); border-radius: 1rem; padding: 1.2rem; box-shadow: var(--shadow); margin-bottom: .8rem; display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center; }
@media (max-width: 640px) { .al-inbox-row { grid-template-columns: 1fr; } }
.al-inbox-row.unread { border-left: 3px solid var(--brand); }
.al-inbox-row .iav { width: 2.6rem; height: 2.6rem; border-radius: 50%; background: linear-gradient(135deg, var(--brand), #60a5fa); color: #fff; display: grid; place-items: center; font-weight: 800; }
.al-inbox-row b { font-size: .95rem; } .al-inbox-row .im { color: var(--muted); font-size: .8rem; margin-top: .2rem; }
.al-inbox-row .req { font-size: .82rem; margin-top: .3rem; } .al-inbox-row .req b { color: var(--brand-ink); }
.al-inbox-row .iactions { display: flex; gap: .5rem; }
.al-src { font-size: .68rem; font-weight: 800; text-transform: uppercase; background: var(--panel2); color: var(--muted); border-radius: 999px; padding: .1rem .45rem; }

/* KANBAN */
.al-kanban { display: grid; grid-template-columns: repeat(5, 1fr); gap: .8rem; overflow-x: auto; }
@media (max-width: 1000px) { .al-kanban { grid-template-columns: repeat(3, minmax(190px,1fr)); } }
@media (max-width: 600px) { .al-kanban { grid-template-columns: repeat(2, minmax(160px,1fr)); } }
.al-col { background: var(--panel2); border: 1px solid var(--line); border-radius: .9rem; padding: .7rem; min-height: 300px; }
.al-col h3 { margin: 0 0 .7rem; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); display: flex; justify-content: space-between; }
.al-col h3 span { background: var(--panel); border-radius: 999px; padding: 0 .5rem; }
.al-lc { background: var(--panel); border: 1px solid var(--line); border-radius: .7rem; padding: .7rem; margin-bottom: .5rem; cursor: pointer; }
.al-lc:hover { border-color: var(--brand); } .al-lc.new { animation: alin .3s ease; border-color: var(--brand); }
@keyframes alin { from { opacity: 0; transform: translateY(-6px); } }
.al-lc b { font-size: .84rem; } .al-lc .lm { color: var(--muted); font-size: .72rem; margin: .25rem 0; }
.al-lc .lval { font-weight: 700; color: var(--brand-ink); font-size: .8rem; }
.al-lc .adv { width: 100%; margin-top: .5rem; border: 1px solid var(--line); background: var(--panel2); color: var(--brand-ink); border-radius: .4rem; padding: .3rem; font: 700 .72rem inherit; cursor: pointer; }
.al-lc .adv:hover { background: var(--brand); color: #fff; }

/* LEAD DETAIL */
.al-lead-back { border: 0; background: transparent; color: var(--brand-ink); font: 600 .85rem inherit; cursor: pointer; margin-bottom: 1rem; }
.al-lead-grid { display: grid; grid-template-columns: 1fr 300px; gap: 1.5rem; align-items: start; }
@media (max-width: 900px) { .al-lead-grid { grid-template-columns: 1fr; } }
.al-lead-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.al-lead-head .av { width: 3rem; height: 3rem; border-radius: 50%; background: linear-gradient(135deg, var(--brand), #60a5fa); color: #fff; display: grid; place-items: center; font-weight: 800; }
.al-lead-head h2 { margin: 0; font-size: 1.35rem; } .al-lead-head .lm { color: var(--muted); font-size: .85rem; }
.al-lead-head .stage-pill { margin-left: auto; font-size: .68rem; font-weight: 800; text-transform: uppercase; padding: .15rem .55rem; border-radius: 999px; color: #fff; }
.al-lead-sec { background: var(--panel); border: 1px solid var(--line); border-radius: 1rem; padding: 1.3rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.al-lead-sec h4 { margin: 0 0 .8rem; font-size: .95rem; }
.al-req { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.al-req div { background: var(--panel2); border-radius: .5rem; padding: .6rem .8rem; font-size: .84rem; }
.al-req div small { color: var(--muted); display: block; font-size: .68rem; text-transform: uppercase; }
.al-match { display: flex; align-items: center; gap: .8rem; border: 1px solid var(--line); border-radius: .7rem; padding: .8rem 1rem; margin-bottom: .5rem; }
.al-match .me { width: 2.4rem; height: 2.4rem; border-radius: .5rem; display: grid; place-items: center; color: #fff; font-size: 1.1rem; }
.al-match .mi { flex: 1; font-size: .85rem; } .al-match .mi b { display: block; } .al-match .mi small { color: var(--muted); }
.al-match .mscore { font-size: .68rem; font-weight: 800; padding: .1rem .4rem; border-radius: 999px; background: #dcfce7; color: var(--ok); }
.al-match .mscore.md { background: #fef9c3; color: var(--warn); }
.al-match button { border: 1px solid var(--line); background: var(--panel); border-radius: .4rem; padding: .25rem .55rem; font: 700 .72rem inherit; cursor: pointer; }
.al-timeline .te { display: flex; gap: .6rem; font-size: .82rem; padding: .35rem 0; }
.al-timeline .te .dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--brand); margin-top: .35rem; flex: none; }
.al-timeline .te small { color: var(--muted); margin-left: auto; }
.al-note-add { display: flex; gap: .5rem; margin-top: .6rem; }
.al-note-add input { flex: 1; font: inherit; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: .5rem; }
.al-lead-side { position: sticky; top: 76px; }
@media (max-width: 900px) { .al-lead-side { position: static; } }
.al-lead-actions { background: var(--panel); border: 1px solid var(--line); border-radius: 1rem; padding: 1.3rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .5rem; }
.al-lead-actions .visit { background: #ede9fe; color: var(--accent); border-radius: .5rem; padding: .6rem .8rem; font-size: .8rem; font-weight: 600; }

/* LISTINGS */
.al-listing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.al-listing { background: var(--panel); border: 1px solid var(--line); border-radius: 1rem; overflow: hidden; box-shadow: var(--shadow); }
.al-listing .img { height: 110px; display: grid; place-items: center; font-size: 2.5rem; color: #fff; position: relative; }
.al-listing .img .excl { position: absolute; top: .5rem; left: .5rem; background: var(--brand-ink); color: #fff; font-size: .62rem; font-weight: 800; padding: .1rem .45rem; border-radius: 999px; }
.al-listing .b { padding: 1rem 1.1rem; }
.al-listing h4 { margin: 0 0 .2rem; font-size: .95rem; } .al-listing .lm { color: var(--muted); font-size: .78rem; }
.al-listing .price { font-weight: 800; color: var(--brand-ink); margin: .4rem 0; }
.al-listing .lstats { display: flex; justify-content: space-between; font-size: .74rem; color: var(--muted); }
.al-listing .lstats b { color: var(--ok); }

/* ANALYTICS */
.al-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.al-kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 1rem; padding: 1.2rem; box-shadow: var(--shadow); }
.al-kpi b { font-size: 1.6rem; font-weight: 800; display: block; } .al-kpi small { color: var(--muted); font-size: .78rem; }
.al-kpi .delta { color: var(--ok); font-size: .74rem; font-weight: 600; }
.al-analytics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; } @media (max-width: 900px) { .al-analytics-grid { grid-template-columns: 1fr; } }
.al-card-wide { grid-column: 1 / -1; } #al-weekchart { width: 100%; height: 180px; }
.al-funnel-row { display: flex; align-items: center; gap: .8rem; padding: .5rem 0; font-size: .84rem; }
.al-funnel-row .n { width: 5.5rem; color: var(--muted); flex: none; }
.al-funnel-row .fb { flex: 1; height: 18px; background: var(--line); border-radius: 4px; overflow: hidden; }
.al-funnel-row .fb i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--accent)); }
.al-funnel-row .v { width: 3rem; text-align: right; font-weight: 700; }
.al-perf-row { display: flex; align-items: center; gap: .8rem; padding: .5rem 0; border-bottom: 1px dashed var(--line); font-size: .83rem; }
.al-perf-row:last-child { border-bottom: 0; } .al-perf-row .n { flex: 1; } .al-perf-row .m { color: var(--muted); }
.al-perf-row .rate { font-weight: 700; color: var(--brand-ink); }

.al-toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); background: var(--brand); color: #fff; padding: .7rem 1.1rem; border-radius: .7rem; font: 700 .88rem inherit; z-index: 200; box-shadow: 0 15px 40px -12px rgba(0,0,0,.4); max-width: 90vw; }
.al-toast[hidden] { display: none; }

/* ---- Wave: drag-and-drop kanban ---- */
.al-col { display: flex; flex-direction: column; transition: background .15s, box-shadow .15s; }
.al-col h3 .stg-dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--stc, #64748b); display: inline-block; margin-right: .35rem; vertical-align: middle; }
.al-col h3 .cnt { background: var(--panel); border-radius: 999px; padding: 0 .5rem; }
.al-col-body { display: flex; flex-direction: column; gap: .5rem; flex: 1; min-height: 60px; }
.al-col.drop { background: color-mix(in srgb, var(--stc) 12%, var(--panel2)); box-shadow: inset 0 0 0 2px var(--stc); }
.al-col.drop .al-col-body::after { content: "Drop here"; display: block; text-align: center; color: var(--stc); font-size: .74rem; font-weight: 700; padding: .6rem; border: 1.5px dashed var(--stc); border-radius: .6rem; }
.al-lc { position: relative; cursor: grab; }
.al-lc:active { cursor: grabbing; }
.al-lc .drag-grip { position: absolute; top: .5rem; right: .5rem; color: var(--muted); font-size: .7rem; letter-spacing: -2px; opacity: .5; }
.al-lc.dragging { opacity: .4; transform: rotate(1.5deg) scale(.98); }
.al-lc.new { animation: al-pop .4s var(--ds-ease, ease); }
@keyframes al-pop { 0% { box-shadow: 0 0 0 2px var(--stc, #2563eb); } 100% { box-shadow: none; } }
