/* Marina Estates — champagne-gold real-estate lead desk
   Identity: calm, expensive, editorial. Fraunces serif display + Inter UI + JetBrains Mono data.
   Borderless tonal surfaces, hairline dividers, generous air. */

:root{
  --bg:#0a0a0a; --surface:#111111; --surface-2:#1a1a1a; --surface-3:#232427;
  --line:rgba(255,255,255,.07); --line-2:rgba(255,255,255,.13);
  --text:#f0f0f0; --muted:#c6cad0; --dim:#80858f;

  --accent:#E8C889;        /* champagne gold */
  --accent-soft:rgba(232,200,137,.14);
  --accent-line:rgba(232,200,137,.30);
  --cream:#fffbd4;         /* secondary */
  --pink:#f4c9d6;          /* rare highlight only */

  --go:#4ade80; --work:#5b9bff; --wait:#ffc24b; --late:#ff6b6b;

  --r:16px; --r-sm:11px;
  --shadow:0 22px 60px -20px rgba(0,0,0,.7);
  --ease:cubic-bezier(.22,.61,.36,1);
}

*{box-sizing:border-box;margin:0;padding:0}
html{-webkit-text-size-adjust:100%}
body{
  font-family:'Inter',system-ui,sans-serif;
  background:var(--bg); color:var(--text);
  line-height:1.5; min-height:100vh; overflow-x:hidden;
  -webkit-font-smoothing:antialiased;
  font-feature-settings:"cv11","ss01";
}
body::before{
  content:''; position:fixed; inset:0; pointer-events:none; z-index:0;
  background:
    radial-gradient(1100px 520px at 82% -12%, rgba(232,200,137,.07), transparent 62%),
    radial-gradient(760px 480px at 8% -4%, rgba(255,251,212,.035), transparent 58%);
}
.mono{font-family:'JetBrains Mono',ui-monospace,monospace;font-feature-settings:"tnum"}

a{color:var(--accent);text-decoration:none}
a:hover{text-decoration:underline;text-underline-offset:2px}

:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:6px}

/* ---------- Top bar ---------- */
.topbar{
  position:sticky; top:0; z-index:40;
  display:flex; align-items:center; justify-content:space-between; gap:18px;
  padding:16px clamp(16px,4vw,42px);
  background:rgba(10,10,10,.72); backdrop-filter:blur(16px) saturate(1.3);
  border-bottom:1px solid var(--line);
}
.brand{display:flex; align-items:center; gap:13px; min-width:0}
.mark{
  display:grid; place-items:center; width:40px; height:40px; flex:none;
  border-radius:11px; color:#0a0a0a;
  background:linear-gradient(150deg, var(--cream), var(--accent) 60%, #c9a85f);
  box-shadow:0 6px 18px -6px rgba(232,200,137,.5);
}
.brand-txt{display:flex; flex-direction:column; line-height:1.1; min-width:0}
.brand-name{font-family:'Fraunces',serif; font-weight:600; font-size:19px; letter-spacing:.1px}
.brand-sub{font-size:11.5px; color:var(--dim); letter-spacing:.02em}
.topbar-right{display:flex; align-items:center; gap:16px}
.ctx{display:flex; align-items:center; gap:14px; color:var(--muted); font-size:13px}
.ctx-item{display:inline-flex; align-items:center; gap:5px; white-space:nowrap}
.ctx-k{color:var(--accent)}
#clock{color:var(--muted); font-size:13px; letter-spacing:.02em}

.btn{
  display:inline-flex; align-items:center; gap:8px; cursor:pointer;
  font-family:inherit; font-size:13.5px; font-weight:500; letter-spacing:.01em;
  min-height:44px; padding:0 16px; border-radius:11px; border:1px solid transparent;
  transition:transform .14s var(--ease), background .18s, border-color .18s, color .18s;
  white-space:nowrap;
}
.btn:active{transform:translateY(1px)}
.btn-primary{background:linear-gradient(160deg,var(--cream),var(--accent) 62%,#d4b76b); color:#181205; font-weight:600; box-shadow:0 8px 22px -10px rgba(232,200,137,.55)}
.btn-primary:hover{filter:brightness(1.05)}
.btn-ghost{background:var(--surface-2); color:var(--muted); border-color:var(--line-2)}
.btn-ghost:hover{color:var(--text); border-color:var(--accent-line); background:var(--surface-3)}

/* ---------- Layout ---------- */
.wrap{position:relative; z-index:1; max-width:1200px; margin:0 auto; padding:clamp(20px,3.4vw,34px) clamp(16px,4vw,42px) 60px}

/* ---------- KPIs (borderless tonal tiles) ---------- */
.kpis{display:grid; grid-template-columns:repeat(5,1fr); gap:14px; margin-bottom:22px}
.kpi{
  background:var(--surface-2); border-radius:var(--r); padding:18px 18px 16px;
  display:flex; flex-direction:column; gap:6px; position:relative; overflow:hidden;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.02);
}
.kpi-hero{background:linear-gradient(165deg, rgba(232,200,137,.10), var(--surface-2) 55%)}
.kpi-hero::after{content:''; position:absolute; left:0; top:0; bottom:0; width:3px; background:linear-gradient(var(--accent),transparent)}
.kpi-label{font-size:12px; color:var(--dim); letter-spacing:.02em}
.kpi-val{font-family:'Fraunces',serif; font-weight:600; font-size:clamp(24px,2.7vw,32px); line-height:1.05; letter-spacing:-.4px}
.kpi-val.mono{font-family:'JetBrains Mono',monospace; font-weight:600; font-size:clamp(20px,2.3vw,27px)}
.kpi-hero .kpi-val{color:var(--accent)}
.kpi-foot{font-size:11.5px; color:var(--dim)}
.bump{animation:bump .5s var(--ease)}
@keyframes bump{0%{transform:scale(1)}35%{transform:scale(1.06)}100%{transform:scale(1)}}

/* ---------- Pipeline strip ---------- */
.pipeline{
  display:grid; grid-template-columns:repeat(5,1fr); gap:10px; margin-bottom:24px;
  background:var(--surface); border-radius:var(--r); padding:8px;
}
.stage{
  position:relative; padding:14px 16px; border-radius:12px; background:transparent;
  display:flex; flex-direction:column; gap:3px; transition:background .2s;
}
.stage:hover{background:var(--surface-2)}
.stage-count{font-family:'Fraunces',serif; font-weight:600; font-size:26px; line-height:1}
.stage-name{font-size:12px; color:var(--muted); letter-spacing:.01em}
.stage-bar{height:3px; border-radius:3px; margin-top:8px; background:var(--line-2)}
.stage[data-s="new"] .stage-bar{background:var(--dim)}
.stage[data-s="contacted"] .stage-bar{background:var(--work)}
.stage[data-s="viewing"] .stage-bar{background:var(--accent)}
.stage[data-s="offer"] .stage-bar{background:var(--wait)}
.stage[data-s="won"] .stage-bar{background:var(--go)}
.stage[data-s="won"] .stage-count{color:var(--go)}

/* ---------- Grid: inbox + agents ---------- */
.grid{display:grid; grid-template-columns:1fr 320px; gap:16px; align-items:start}
.panel-card{background:var(--surface); border-radius:var(--r); overflow:hidden}
.card-head{
  display:flex; align-items:flex-start; justify-content:space-between; gap:14px;
  padding:18px 20px 14px;
}
.card-head h2{font-family:'Fraunces',serif; font-weight:600; font-size:19px; letter-spacing:.1px}
.card-sub{font-size:12.5px; color:var(--dim); margin-top:2px}

/* ---------- Inbox (borderless rows, hairline dividers) ---------- */
.inbox{display:flex; flex-direction:column}
.lead{
  display:grid; grid-template-columns:10px 1fr auto; gap:14px; align-items:center;
  padding:15px 20px; border-top:1px solid var(--line); cursor:pointer;
  transition:background .16s; position:relative;
}
.lead:first-child{border-top:none}
.lead:hover{background:var(--surface-2)}
.lead:focus-visible{outline-offset:-2px}
.dot{width:9px; height:9px; border-radius:50%; margin-top:1px; flex:none; box-shadow:0 0 0 4px rgba(255,255,255,.02)}
.dot.new{background:var(--dim)}
.dot.contacted{background:var(--work)}
.dot.viewing{background:var(--accent)}
.dot.offer{background:var(--wait)}
.dot.won{background:var(--go)}

.lead-main{min-width:0}
.lead-top{display:flex; align-items:center; gap:9px; flex-wrap:wrap}
.lead-name{font-weight:600; font-size:14.5px; letter-spacing:.005em}
.src{
  font-family:'JetBrains Mono',monospace; font-size:10.5px; font-weight:500;
  padding:2px 7px; border-radius:6px; letter-spacing:.02em; white-space:nowrap;
  background:var(--surface-3); color:var(--muted);
}
.src.propertyfinder{color:#7fd4c8; background:rgba(127,212,200,.12)}
.src.bayut{color:#8fd06a; background:rgba(143,208,106,.12)}
.src.dubizzle{color:#e39ad0; background:rgba(227,154,208,.12)}
.src.whatsapp{color:#7fe0a0; background:rgba(127,224,160,.12)}
.src.website{color:var(--accent); background:var(--accent-soft)}
.lead-meta{font-size:12.5px; color:var(--dim); margin-top:3px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.lead-meta b{color:var(--muted); font-weight:500}
.budget{font-family:'JetBrains Mono',monospace; color:var(--cream); font-weight:500}

.lead-right{display:flex; flex-direction:column; align-items:flex-end; gap:6px; text-align:right; flex:none}
.status{font-size:12px; color:var(--muted); display:flex; align-items:center; gap:6px; white-space:nowrap}
.status .timer{font-family:'JetBrains Mono',monospace; font-size:11.5px; color:var(--dim)}
.status.replied{color:var(--go)}
.status.pending{color:var(--wait)}
.pill-score{
  font-family:'JetBrains Mono',monospace; font-size:11px; font-weight:600;
  padding:2px 8px; border-radius:20px; letter-spacing:.01em;
}
.pill-score.hot{color:#181205; background:linear-gradient(120deg,var(--cream),var(--accent))}
.pill-score.warm{color:var(--accent); background:var(--accent-soft)}
.pill-score.cold{color:var(--dim); background:var(--surface-3)}

.lead.enter{animation:leadIn .6s var(--ease)}
@keyframes leadIn{
  0%{background:var(--accent-soft); opacity:0; transform:translateY(-8px)}
  60%{opacity:1; transform:none}
  100%{background:transparent}
}
.lead.flash{animation:flash .9s var(--ease)}
@keyframes flash{0%{background:var(--accent-soft)}100%{background:transparent}}

/* ---------- Agents ---------- */
.agents{display:flex; flex-direction:column}
.agent{
  display:flex; align-items:center; gap:12px; padding:13px 20px; border-top:1px solid var(--line);
}
.agent:first-child{border-top:none}
.av{
  width:36px; height:36px; border-radius:10px; flex:none; display:grid; place-items:center;
  font-family:'Fraunces',serif; font-weight:600; font-size:14px; color:#181205;
}
.agent-mid{min-width:0; flex:1}
.agent-name{font-size:13.5px; font-weight:500}
.agent-stat{font-size:11.5px; color:var(--dim); margin-top:1px}
.agent-stat .mono{color:var(--muted)}
.agent-load{text-align:right; flex:none}
.agent-load .n{font-family:'JetBrains Mono',monospace; font-weight:600; font-size:15px}
.agent-load .l{font-size:10.5px; color:var(--dim)}
.agent .free{color:var(--go)}
.agent .busy{color:var(--wait)}
.agents-note{padding:14px 20px; font-size:11.5px; color:var(--dim); border-top:1px solid var(--line)}

/* ---------- Demo chip ---------- */
.demo-foot{margin-top:26px; display:flex; justify-content:center}
.demo-chip{
  font-size:12px; color:var(--dim); padding:7px 14px; border-radius:20px;
  background:var(--surface); border:1px solid var(--line);
}
.demo-chip a{color:var(--muted)}

/* ---------- Side panel ---------- */
.scrim{position:fixed; inset:0; z-index:50; background:rgba(0,0,0,.5); backdrop-filter:blur(2px); animation:fade .2s}
@keyframes fade{from{opacity:0}to{opacity:1}}
.side{
  position:fixed; top:0; right:0; z-index:60; height:100dvh; width:min(430px,100vw);
  background:var(--surface); border-left:1px solid var(--line-2);
  transform:translateX(100%); transition:transform .34s var(--ease);
  box-shadow:var(--shadow); overflow-y:auto; overscroll-behavior:contain;
}
.side.open{transform:none}
.side-inner{padding:22px 22px 40px}

.side-head{display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:18px}
.side-eyebrow{font-size:11.5px; color:var(--accent); letter-spacing:.03em; margin-bottom:5px}
.side-title{font-family:'Fraunces',serif; font-weight:600; font-size:23px; line-height:1.15; letter-spacing:-.2px}
.x{
  width:38px; height:38px; flex:none; border-radius:10px; cursor:pointer; border:1px solid var(--line-2);
  background:var(--surface-2); color:var(--muted); display:grid; place-items:center; transition:.15s;
}
.x:hover{color:var(--text); border-color:var(--accent-line)}

.field{margin-bottom:14px}
.field-l{font-size:11.5px; color:var(--dim); margin-bottom:5px; letter-spacing:.02em}
.field-v{font-size:14.5px; color:var(--text)}
.field-v.mono{font-size:14px}
.detail-grid{display:grid; grid-template-columns:1fr 1fr; gap:12px 16px; margin:6px 0 18px;
  padding:16px; background:var(--surface-2); border-radius:12px}
.msg-quote{
  background:var(--surface-2); border-radius:12px; padding:15px 16px; margin:2px 0 18px;
  font-size:14px; color:var(--muted); line-height:1.6; border-left:2px solid var(--accent-line);
}
.score-row{display:flex; align-items:center; gap:14px; margin:2px 0 18px; padding:16px; background:var(--surface-2); border-radius:12px}
.score-big{font-family:'JetBrains Mono',monospace; font-weight:600; font-size:34px; line-height:1}
.score-big.hot{color:var(--accent)} .score-big.warm{color:var(--cream)} .score-big.cold{color:var(--muted)}
.score-why{font-size:12.5px; color:var(--dim); line-height:1.5}

label.sel-l{display:block; font-size:11.5px; color:var(--dim); margin:0 0 6px; letter-spacing:.02em}
select.sel{
  width:100%; min-height:46px; padding:0 12px; border-radius:11px; cursor:pointer;
  background:var(--surface-2); color:var(--text); border:1px solid var(--line-2);
  font-family:inherit; font-size:14px; margin-bottom:16px;
  appearance:none; background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2380858f' stroke-width='1.6'><path d='M4 6l4 4 4-4'/></svg>");
  background-repeat:no-repeat; background-position:right 12px center;
}
select.sel:focus-visible{border-color:var(--accent)}
.side-actions{display:flex; gap:10px; margin-top:6px}
.side-actions .btn{flex:1; justify-content:center}

/* ---------- AI report ---------- */
.gen{display:flex; flex-direction:column; align-items:center; justify-content:center; gap:16px; padding:70px 0; text-align:center}
.gen-ring{width:34px; height:34px; border-radius:50%; border:2.5px solid var(--line-2); border-top-color:var(--accent); animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.gen-txt{font-size:13.5px; color:var(--muted)}

.rep-toggle{display:inline-flex; padding:3px; background:var(--surface-2); border-radius:10px; margin-bottom:16px}
.rep-toggle button{
  border:none; background:transparent; color:var(--dim); cursor:pointer; font-family:inherit;
  font-size:12.5px; font-weight:500; padding:7px 15px; border-radius:8px; min-height:36px; transition:.15s;
}
.rep-toggle button.on{background:var(--accent); color:#181205; font-weight:600}
.rep-summary{font-size:14px; color:var(--muted); line-height:1.62; margin-bottom:18px}
.rep-summary b{color:var(--text); font-weight:600}
.rep-tiles{display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:20px}
.rep-tile{background:var(--surface-2); border-radius:12px; padding:14px}
.rep-tile .l{font-size:11.5px; color:var(--dim); margin-bottom:6px}
.rep-tile .v{font-family:'Fraunces',serif; font-weight:600; font-size:22px; line-height:1}
.rep-tile .d{font-size:11.5px; margin-top:6px; font-family:'JetBrains Mono',monospace}
.d.up{color:var(--go)} .d.down{color:var(--late)} .d.flat{color:var(--dim)}

.rep-h{font-family:'Fraunces',serif; font-weight:600; font-size:15px; margin:20px 0 10px; display:flex; align-items:center; gap:8px}
.rep-h::before{content:''; width:6px; height:6px; border-radius:50%; background:var(--accent)}
.rep-list{list-style:none; display:flex; flex-direction:column; gap:9px}
.rep-list li{font-size:13.5px; color:var(--muted); line-height:1.5; padding-left:18px; position:relative}
.rep-list li::before{content:''; position:absolute; left:2px; top:8px; width:6px; height:1px; background:var(--dim)}
.rep-list.todo li::before{content:''; left:0; top:5px; width:9px; height:9px; border-radius:3px; background:var(--accent-soft); border:1px solid var(--accent-line)}
.rep-export{margin-top:24px; width:100%; justify-content:center}

/* ---------- Toasts ---------- */
.toasts{position:fixed; left:20px; bottom:20px; z-index:80; display:flex; flex-direction:column; gap:10px; max-width:min(360px,calc(100vw - 40px))}
.toast{
  display:flex; align-items:flex-start; gap:11px; padding:13px 15px; border-radius:12px;
  background:var(--surface-3); border:1px solid var(--line-2); box-shadow:var(--shadow);
  animation:toastIn .3s var(--ease); font-size:13px;
}
.toast.out{animation:toastOut .3s var(--ease) forwards}
@keyframes toastIn{from{opacity:0; transform:translateX(-16px)}to{opacity:1; transform:none}}
@keyframes toastOut{to{opacity:0; transform:translateX(-16px)}}
.toast-ic{width:20px; height:20px; flex:none; display:grid; place-items:center; border-radius:6px; margin-top:1px}
.toast-ic.go{color:var(--go); background:rgba(74,222,128,.13)}
.toast-ic.gold{color:var(--accent); background:var(--accent-soft)}
.toast-ic.work{color:var(--work); background:rgba(91,155,255,.13)}
.toast-b{min-width:0}
.toast-t{font-weight:600; font-size:13px; margin-bottom:1px}
.toast-d{color:var(--dim); font-size:12px; line-height:1.4}

/* ---------- Responsive ---------- */
@media(max-width:940px){
  .kpis{grid-template-columns:repeat(3,1fr)}
  .kpi-hero{grid-column:span 3; order:-1}
  .grid{grid-template-columns:1fr}
  .agents-card{order:2}
}
@media(max-width:640px){
  .brand-sub{display:none}
  .ctx{display:none}
  .kpis{grid-template-columns:1fr 1fr}
  .kpi-hero{grid-column:span 2}
  .pipeline{grid-template-columns:1fr 1fr 1fr; gap:6px}
  .stage[data-s="offer"]{grid-column:span 1}
  .lead{grid-template-columns:9px 1fr; gap:11px}
  .lead-right{grid-column:2; flex-direction:row; align-items:center; justify-content:space-between; width:100%; margin-top:6px}
  .rep-tiles{grid-template-columns:1fr}
  .toasts{left:12px; right:12px; bottom:12px; max-width:none}
}
@media(max-width:380px){
  .kpis{grid-template-columns:1fr}
  .kpi-hero{grid-column:span 1}
}

@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{animation:none !important; transition:none !important}
  .side{transition:none}
}
