:root {
  --ink: #111827; --muted: #6b7280; --line: #e5e7eb; --bg: #eef1fd;
  --brand: #4f46e5; --brand2: #7c3aed; --ok: #047857; --red: #b91c1c;
  --ws-bg: #eef1fd; --ws-panel: #ffffff; --ws-line: rgba(79,70,229,.14);
  --ws-ink: #23264d; --ws-muted: #5d648f;
  --brand1: #7dd3fc; --grad: linear-gradient(135deg, #7dd3fc, #a78bfa);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; color: var(--ink); background: transparent; line-height: 1.5; font-size: 15px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; background: var(--brand); color: #fff; border: 0; border-radius: 9px; padding: .5rem 1rem; font-weight: 600; }
button:hover { filter: brightness(1.08); }
button.ghost { background: #fff; color: var(--muted); border: 1px solid var(--line); }
button.ghost:hover { color: var(--ink); filter: none; }
button.small, .btn.small { padding: .3rem .7rem; font-size: .84rem; }
button.red { color: var(--red); }
input, select, textarea { border: 1px solid var(--line); border-radius: 9px; padding: .5rem .7rem; background: #fff; width: 100%; }
a { color: var(--brand); }
.muted { color: var(--muted); } .small { font-size: .86rem; } .tiny { font-size: .78rem; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.err { color: var(--red); }
.row { display: flex; align-items: center; gap: .5rem; } .row.wrap { flex-wrap: wrap; }
.sp { flex: 1; }
.boot { padding: 4rem; text-align: center; color: var(--muted); }

/* auth + capture */
.authwrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; background: radial-gradient(800px 400px at 20% 0%, rgba(237,233,254,.5), transparent 65%), radial-gradient(700px 380px at 90% 10%, rgba(224,231,255,.45), transparent 65%); }
.authcard { background: #fff; border-radius: 16px; box-shadow: 0 10px 40px rgba(30,27,75,.12); padding: 2rem; width: min(420px, 94vw); }
.authcard h1 { margin: .2rem 0 .2rem; font-size: 1.3rem; }
.authcard form { display: grid; gap: .65rem; margin: 1.1rem 0; }
.authcard button { margin-top: .2rem; }
.brand { font-weight: 800; letter-spacing: -.01em; }
.branddot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: linear-gradient(135deg, var(--brand), var(--brand2)); margin-right: .2rem; }
.brandsub { font-weight: 500; color: var(--muted); font-size: .8rem; }
.swap { text-align: center; margin: .4rem 0 0; font-size: .9rem; }
.chk { display: flex; gap: .45rem; align-items: center; font-size: .9rem; color: var(--muted); }
.chk input { width: auto; }

/* shell — Replit-style: dark workspace chrome, light data canvas */
.shell { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.shell.hasdrawer { grid-template-columns: 228px 1fr 360px; }
.side { background: var(--ws-panel); border-right: 1px solid var(--ws-line); padding: 1rem .8rem calc(2.6rem + 30px); display: flex; flex-direction: column; gap: 1.1rem; position: sticky; top: 0; height: 100vh; }
.side .brandrow { display: grid; gap: .1rem; color: var(--ws-ink); padding-bottom: .6rem; border-bottom: 1px solid var(--ws-line); }
.side .brandline { display: flex; align-items: center; gap: .55rem; }
.side .brandrow svg { display: block; }
.side .brandtext { font-weight: 800; letter-spacing: -.015em; font-size: .98rem; white-space: nowrap; }
.side .brandtext em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.side .brandrow .appname { font-weight: 700; font-size: .66rem; color: var(--ws-muted); font-family: var(--mono); letter-spacing: .16em; }
.side nav { display: grid; gap: .25rem; }
.side nav button { background: transparent; color: var(--ws-ink); text-align: left; font-weight: 600; padding: .55rem .8rem; border-radius: 9px; display: flex; gap: .45rem; align-items: center; border: 1px solid transparent; }
.side nav button:hover { background: #e9ecff; filter: none; border-color: transparent; }
.side nav button.on { background: rgba(125, 211, 252, .1); color: var(--brand1); border-color: rgba(125, 211, 252, .25); }
.side .count { background: var(--grad); color: #0a0f1e; border-radius: 999px; font-size: .7rem; padding: .05rem .45rem; font-weight: 800; }
.sidefoot { margin-top: auto; display: grid; gap: .4rem; color: var(--ws-muted); }
.sidefoot .muted { color: var(--ws-muted); }
.sidefoot .ghost { background: transparent; color: var(--ws-muted); border-color: var(--ws-line); }
.sidefoot .ghost:hover { color: var(--ws-ink); }
.sidefoot .pill.trial { background: rgba(125, 211, 252, .1); color: var(--brand1); border: 1px solid rgba(125, 211, 252, .3); }
.main { padding: 1.4rem 1.8rem calc(1.4rem + 30px); min-width: 0; }
.pill { font-size: .74rem; font-weight: 700; padding: .2rem .6rem; border-radius: 999px; }
.pill.trial { background: #ecfdf5; color: var(--ok); border: 1px solid #a7f3d0; }
.pill.wf { background: #eff6ff; color: #1d4ed8; font-size: .68rem; }
.pagehead { display: flex; align-items: center; gap: .8rem; margin-bottom: 1rem; flex-wrap: wrap; }
.pagehead h1 { font-size: 1.25rem; margin: 0; }
.pagehead p { margin: 0; width: 100%; }
.sect { font-size: .95rem; margin: 1.4rem 0 .5rem; }
.search { max-width: 340px; margin-bottom: .8rem; }
.flash { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: .5rem 1rem; border-radius: 10px; opacity: 0; transition: opacity .25s; pointer-events: none; z-index: 90; }
.flash.on { opacity: .95; }
.flash.err { background: var(--red); }

/* today */
.duecard { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: .9rem 1rem; margin-bottom: .7rem; max-width: 720px; }
.duecard.overdue { border-color: #fecaca; background: #fffafa; }
.duehead { display: flex; gap: .5rem; align-items: center; margin-bottom: .3rem; }
.chanchip { font-size: .66rem; font-weight: 800; letter-spacing: .06em; padding: .15rem .5rem; border-radius: 999px; background: #dcfce7; color: #166534; }
.chanchip.reminder { background: #fef3c7; color: #92400e; }
.due { margin-left: auto; font-size: .8rem; font-weight: 700; color: var(--ok); }
.due.red { color: var(--red); }
.duename { font-weight: 700; }
.msg { background: #f9fafb; border: 1px solid var(--line); border-radius: 10px; padding: .55rem .7rem; margin: .5rem 0; font-size: .92rem; white-space: pre-wrap; }
.btn { display: inline-block; text-decoration: none; border-radius: 9px; padding: .45rem .9rem; font-weight: 700; font-size: .88rem; }
.btn.wa { background: #dcfce7; color: #14532d; border: 1px solid #86efac; font-weight: 800; }
.empty { border: 1px dashed var(--line); border-radius: 14px; padding: 2rem; text-align: center; max-width: 720px; }
.uplist { max-width: 720px; }
.uprow { display: flex; justify-content: space-between; gap: .8rem; padding: .4rem .2rem; border-bottom: 1px solid var(--line); font-size: .9rem; }

/* pipeline */
.board { display: grid; grid-template-columns: repeat(6, minmax(160px, 1fr)); gap: .6rem; overflow-x: auto; padding-bottom: 1rem; }
.col { background: #fff; border: 1px solid var(--line); border-radius: 12px; min-height: 200px; display: flex; flex-direction: column; }
.colhead { display: flex; justify-content: space-between; padding: .55rem .7rem; font-weight: 700; font-size: .85rem; border-bottom: 1px solid var(--line); }
.coltotal { padding: .3rem .7rem 0; font-size: .78rem; color: var(--ok); font-weight: 700; }
.colbody { padding: .5rem; display: grid; gap: .4rem; align-content: start; flex: 1; }
.colghost { color: #d1d5db; text-align: center; padding: 1rem 0; }
.lead { background: #f9fafb; border: 1px solid var(--line); border-radius: 9px; padding: .5rem .6rem; cursor: pointer; }
.lead:hover { background: #eef2ff; }
.leadname { font-weight: 600; font-size: .9rem; }
.leadval { color: var(--ok); font-weight: 700; font-size: .84rem; }
.tinynext { font-size: .72rem; color: var(--muted); }

/* contacts table */
.ctbl { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.ctbl th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .55rem .8rem; border-bottom: 1px solid var(--line); background: #fafafa; }
.ctbl td { padding: .55rem .8rem; border-bottom: 1px solid var(--line); font-size: .92rem; }
.ctbl tr[data-id] { cursor: pointer; }
.ctbl tr:hover td, .ctbl tr.sel td { background: #eef2ff; }
.stagechip { font-size: .72rem; font-weight: 700; padding: .15rem .55rem; border-radius: 999px; background: #f3f4f6; }
.stagechip.new { background: #ede9fe; color: #5b21b6; }
.stagechip.contacted { background: #e0f2fe; color: #075985; }
.stagechip.qualified { background: #dbeafe; color: #1d4ed8; }
.stagechip.proposal { background: #fef3c7; color: #92400e; }
.stagechip.won { background: #dcfce7; color: #166534; }
.stagechip.lost { background: #fee2e2; color: #991b1b; }

/* drawer */
.drawer { background: #fff; border-left: 1px solid var(--line); padding: 1.1rem 1rem; overflow-y: auto; height: 100vh; position: sticky; top: 0; }
.drawer .dhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; }
.drawer h2 { margin: 0; font-size: 1.1rem; }
.drawer h3.sect { margin: 1.1rem 0 .4rem; font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.dgrid { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem .6rem; margin-bottom: .7rem; }
.dgrid label { font-size: .74rem; color: var(--muted); display: grid; gap: .25rem; font-weight: 600; }
.dgrid .full { grid-column: 1 / -1; }
.logform { display: grid; grid-template-columns: 110px 1fr auto; gap: .4rem; margin-bottom: .4rem; }

/* sequences */
.seqcard { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; margin-bottom: .6rem; max-width: 860px; }
.seqform { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1rem; max-width: 860px; display: grid; gap: .5rem; }
.steprow { display: grid; grid-template-columns: 70px 130px 1fr; gap: .4rem; }

/* settings */
.capbox { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1rem; max-width: 760px; display: grid; gap: .6rem; }
.capbox pre { background: #f9fafb; border: 1px solid var(--line); border-radius: 8px; padding: .7rem; overflow-x: auto; margin: 0; }

/* statusbar (MFQ workspace chrome) */
.statusbar { position: fixed; left: 228px; right: 0; bottom: 0; z-index: 25; height: 30px; display: flex; align-items: center; gap: 1.1rem; padding: 0 1rem; background: rgba(255, 255, 255, .85); border-top: 1px solid var(--ws-line); font-family: var(--mono); font-size: .73rem; letter-spacing: .02em; color: #5d648f; }
.statusbar .sp { flex: 1; }
.statusbar .okdot { width: 7px; height: 7px; border-radius: 50%; background: #34d399; display: inline-block; margin-right: .35rem; }
.statusbar b { color: #dfe6ff; font-weight: 700; }
.drawer { z-index: 26; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modalcard { background: #fff; border-radius: 16px; padding: 1.5rem; width: min(440px, 94vw); display: grid; gap: .7rem; box-shadow: 0 18px 50px rgba(0,0,0,.25); }
.modalcard h2 { margin: 0; font-size: 1.1rem; }

@media (max-width: 980px) {
  .shell, .shell.hasdrawer { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; padding-bottom: 1rem; }
  .side nav { display: flex; overflow-x: auto; }
  .sidefoot { margin: 0 0 0 auto; }
  .statusbar { left: 0; }
  .board { grid-template-columns: repeat(6, 200px); }
  .dgrid, .logform { grid-template-columns: 1fr; }
}

/* ---------- bubble field (v2 light) ---------- */
body::before, body::after { content: ""; position: fixed; z-index: -1; border-radius: 50%; filter: blur(60px); opacity: .55; pointer-events: none; }
body::before { width: 44vw; height: 44vw; left: -12vw; top: -14vw; background: radial-gradient(circle at 35% 35%, rgba(125,211,252,.75), rgba(125,211,252,0) 70%); animation: drift1 26s ease-in-out infinite alternate; }
body::after { width: 50vw; height: 50vw; right: -16vw; bottom: -18vw; background: radial-gradient(circle at 60% 60%, rgba(167,139,250,.65), rgba(167,139,250,0) 70%); animation: drift2 32s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(6vw, 4vh) scale(1.08); } }
@keyframes drift2 { to { transform: translate(-5vw, -6vh) scale(1.06); } }
@media (prefers-reduced-motion: reduce) { body::before, body::after { animation: none; } }

/* ---------- v2.1: bubble visibility + drift strength ---------- */
html { background: radial-gradient(1100px 500px at 85% -10%, rgba(167, 139, 250, .20), transparent 60%), radial-gradient(900px 460px at -10% 0%, rgba(125, 211, 252, .22), transparent 55%), var(--bg); }
body::before { opacity: .85; width: 52vw; height: 52vw; }
body::after { opacity: .78; width: 58vw; height: 58vw; }

/* ---------- v2.2: distinct bubble orbs + button definition ---------- */
html::before { content: ""; position: fixed; z-index: -1; width: 22vw; height: 22vw; left: 55vw; top: 8vh; border-radius: 50%; filter: blur(50px); opacity: .8; background: radial-gradient(circle at 40% 40%, rgba(244, 114, 182, .55), transparent 70%); animation: drift1 30s ease-in-out infinite alternate; }
html::after { content: ""; position: fixed; z-index: -1; width: 16vw; height: 16vw; right: 30vw; bottom: 14vh; border-radius: 50%; filter: blur(45px); opacity: .75; background: radial-gradient(circle at 40% 40%, rgba(125, 211, 252, .65), transparent 70%); animation: drift2 24s ease-in-out infinite alternate; }
@media (prefers-reduced-motion: reduce) { html::before, html::after { animation: none; } }

/* ---------- v2.3: orb presence + card frost ---------- */
body::before { opacity: .95; }
body::after { opacity: .9; }
html::before { opacity: .95; width: 26vw; height: 26vw; }
html::after { opacity: .9; width: 20vw; height: 20vw; }
.authcard, .cards .empty, .panelcard { background: rgba(255, 255, 255, .86); backdrop-filter: blur(14px); box-shadow: 0 10px 34px rgba(79, 70, 229, .13); }
/* ---------- v2.4: orb saturation ---------- */
body::before { background: radial-gradient(circle at 35% 35%, rgba(125,211,252,.9), rgba(125,211,252,0) 70%); }
body::after { background: radial-gradient(circle at 60% 60%, rgba(167,139,250,.85), rgba(167,139,250,0) 70%); }
html::before { background: radial-gradient(circle at 40% 40%, rgba(244,114,182,.75), rgba(244,114,182,0) 70%); }
html::after { background: radial-gradient(circle at 40% 40%, rgba(125,211,252,.85), rgba(125,211,252,0) 70%); }
/* ---------- v2.5: true frost on auth cards ---------- */
.authcard { background: rgba(255, 255, 255, .7) !important; backdrop-filter: blur(18px) saturate(1.2); box-shadow: 0 14px 44px rgba(79, 70, 229, .18) !important; }
/* ---------- v2.6: true glass — prescribed: alpha .6, blur24+sat, border, orb overlap ---------- */
.authcard { background: rgba(255, 255, 255, .6) !important; backdrop-filter: blur(24px) saturate(160%); -webkit-backdrop-filter: blur(24px) saturate(160%); border: 1px solid rgba(255,255,255,.45); box-shadow: 0 18px 50px rgba(79, 70, 229, .18); }
html::before { left: 56vw; top: 30vh; }
body::after { right: 6vw; bottom: 2vh; }
.authcard input { background: rgba(255,255,255,.75); }
/* ---------- v2.7: hero bloom behind the card ---------- */
html::before { left: 50%; top: 42vh; transform: translate(-50%, -50%); width: 36vw; height: 36vw; animation: none; opacity: .95; background: radial-gradient(circle at 40% 40%, rgba(217, 70, 239, .5), rgba(217, 70, 239, 0) 70%); }
.authcard { box-shadow: 0 18px 50px rgba(79, 70, 229, .18), inset 0 1px 0 rgba(255,255,255,.7); }
/* ---------- v2.8: bloom alignment + link styling (final) ---------- */
html::before { left: 56vw; top: 26vh; }
.authcard { background: rgba(255, 255, 255, .5) !important; box-shadow: 0 18px 50px rgba(79, 70, 229, .18), inset 0 1px 0 rgba(255,255,255,.75), inset 0 0 60px rgba(180,120,255,.16); border: 1px solid rgba(255,255,255,.6); }
.authwrap a, .authcard a { color: var(--brand, #4f46e5); font-weight: 700; text-decoration: none; }
.authwrap a:hover { text-decoration: underline; }

/* ---------- reports (Scale) + plan box ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .7rem; margin: 0 0 1rem; max-width: 900px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: .75rem .9rem; display: grid; gap: .1rem; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.kpi > span:first-child { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.kpi b { font-size: 1.28rem; letter-spacing: -.01em; }
.kpi .tiny { color: var(--muted); }
.rgrid { display: grid; grid-template-columns: 1.15fr 1fr; gap: .8rem; max-width: 900px; }
.rcard { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: .9rem 1rem; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
#rbody .rcard:last-child { margin-bottom: 1.4rem; }
.fbar { display: flex; align-items: center; gap: .6rem; margin: .45rem 0; }
.flabel { width: 82px; font-size: .8rem; font-weight: 700; flex: none; }
.ftrack { flex: 1; height: 22px; background: #f1f3ff; border-radius: 7px; overflow: hidden; display: block; }
.ffill { display: block; height: 100%; background: var(--grad); border-radius: 7px; min-width: 3px; }
.fmeta { width: 108px; flex: none; font-size: .76rem; color: var(--muted); text-align: right; white-space: nowrap; }
.wchart { display: flex; align-items: stretch; gap: .5rem; height: 128px; padding-top: .3rem; }
.wcol { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: .25rem; }
.wfill { width: 72%; max-width: 46px; background: var(--grad); border-radius: 7px 7px 3px 3px; display: block; }
.wlab { font-size: .64rem; color: var(--muted); font-family: var(--mono); }
.chanchip.call, .chanchip.email { background: #eff6ff; color: #1d4ed8; }
.chanchip.sms { background: #fef3c7; color: #92400e; }
.chanchip.note { background: #f3f4f6; color: #374151; }
.chanchip.reminder { background: #fef3c7; color: #92400e; }
.planbox { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1rem; max-width: 640px; display: grid; gap: .65rem; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.tierrow { border: 1px solid var(--line); border-radius: 10px; padding: .55rem .7rem; display: grid; gap: .05rem; }
.tierrow b { font-size: 1.02rem; }
.tierrow.hl { border-color: #c4b5fd; background: #f5f3ff; }
@media (max-width: 980px) { .rgrid { grid-template-columns: 1fr; } .tiers { grid-template-columns: 1fr; } }
