:root {
  /* CoBanq brand: navy from the logo, electric blue + green from the signature bar, Inter throughout */
  --navy: #040433; --navy-2: #0b1a4a; --bg: #f5f7fc; --panel: #ffffff; --fg: #0f1233; --muted: #5f6684; --line: #e3e7f3;
  --accent: #3b5bfd; --c1: #4f6df5; --c2: #1f8a70; --ok: #1f8a70; --bad: #c0392b; --warn: #b7791f; --radius: 12px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 15px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--bad); min-height: 1.2em; }
a { color: var(--c1); }
h1 { font-size: 24px; margin: 0 0 4px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 16px; margin: 0 0 4px; font-weight: 600; }
h3 { font-size: 14px; margin: 18px 0 6px; font-weight: 600; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
label.row { display: flex; align-items: center; gap: 8px; color: var(--fg); font-size: 14px; }
input, select, textarea { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--fg); margin-top: 4px; }
input[type=checkbox] { width: auto; margin: 0; }
textarea { resize: vertical; }
.btn { font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--fg); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); margin-top: 12px; font-weight: 600; }
.btn.primary:hover { background: #2f4de0; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); border-color: transparent; background: transparent; padding: 2px 6px; }
.btn:disabled { opacity: .5; cursor: default; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(1200px 600px at 20% 0%, #14237a 0%, var(--navy) 55%, #02021f 100%); }
.login-card { background: #fff; padding: 32px; border-radius: 14px; width: min(100%, 380px); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login-logo { width: 140px; display: block; margin-bottom: 14px; }
.login-card h1 { font-size: 20px; }
.login-card .btn.primary { width: 100%; }

.topbar { display: flex; align-items: center; gap: 24px; padding: 10px max(16px, 3vw); background: linear-gradient(90deg, var(--navy), var(--navy-2)); color: #fff; flex-wrap: wrap; border-bottom: 3px solid var(--accent); }
.brand { height: 34px; }
#nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
#nav a { color: #c9cde6; text-decoration: none; padding: 8px 12px; border-radius: 8px; font-size: 14px; }
#nav a.active { background: var(--accent); color: #fff; }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #c9cde6; }
.who .btn { color: #fff; border-color: rgba(255,255,255,.3); padding: 5px 10px; }
.banner { background: #fff4e0; color: #7a4b00; padding: 10px max(16px, 3vw); font-size: 14px; border-bottom: 1px solid #f1d9a6; }

main { padding: 20px max(16px, 3vw) 60px; max-width: 1200px; margin-inline: auto; display: grid; gap: 20px; }
.headline p { margin: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 2px; }
.tile .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.tile .v { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tile .d { color: var(--muted); font-size: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.card .note { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.chart { min-height: 220px; position: relative; }
.chart.short { min-height: 140px; }
.chart svg { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.tip { position: absolute; pointer-events: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.12); padding: 6px 10px; font-size: 12px; white-space: nowrap; display: none; z-index: 2; }
.funnel { display: grid; gap: 8px; }
.frow { display: grid; grid-template-columns: 120px 1fr 70px; align-items: center; gap: 10px; font-size: 13px; }
.frow .lab { color: var(--muted); }
.frow .bar { height: 20px; border-radius: 6px; background: #d6ddf7; min-width: 3px; }
.frow .bar.hot { background: var(--c2); }
.frow .bar { background: #dbe2fb; }
.frow .n { text-align: right; font-variant-numeric: tabular-nums; }
.frow .pct { color: var(--muted); font-size: 11px; }
.tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.tools input, .tools select { width: auto; min-width: 180px; margin: 0; }
.tbox { max-height: 70vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { position: sticky; top: 0; background: #fff; text-align: left; padding: 10px; border-bottom: 1px solid var(--line); cursor: pointer; white-space: nowrap; user-select: none; }
th[aria-sort=ascending]::after { content: " ▲"; color: var(--muted); } th[aria-sort=descending]::after { content: " ▼"; color: var(--muted); }
td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.plain th { position: static; cursor: default; }
table.plain td input { margin: 0; padding: 6px 8px; }
.status { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.status i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
td select { width: auto; margin: 0; padding: 4px 6px; font-size: 12px; }
ul.notes { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
ul.notes li { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; padding: 10px 12px; background: #f8f9fd; border-radius: 8px; font-size: 14px; }
ul.notes .meta { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: #e8ecfb; color: #3a4a9a; margin-left: 6px; }
.actions { display: flex; gap: 12px; align-items: center; }
.replies .r { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.replies .r:last-child { border: 0; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--navy-2); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25); z-index: 10; }
.toast.err { background: var(--bad); }
@media (max-width: 640px) { .narrow-hide { display: none; } .frow { grid-template-columns: 90px 1fr 60px; } }

/* ---- Agent floor ---- */
.floor-card { background: linear-gradient(180deg, #0b1a4a 0%, #040433 100%); border-color: #1a2a66; color: #fff; overflow: hidden; }
.floor-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px; }
.floor-card h2 { color: #fff; display: flex; align-items: center; gap: 10px; }
.floor-card .note { color: #b4bce0; }
.live { font-size: 11px; font-weight: 600; letter-spacing: .08em; color: #8ef0c6; display: inline-flex; align-items: center; gap: 6px; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: #2ee59d; box-shadow: 0 0 0 0 rgba(46,229,157,.6); animation: pulse 2s infinite; }
.floor { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 12px; margin-top: 10px; }
.agent { position: relative; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); border-radius: 14px; padding: 12px 12px 10px; display: grid; justify-items: center; gap: 4px; text-align: center; transition: transform .2s, background .2s; }
.agent:hover { background: rgba(255,255,255,.12); transform: translateY(-2px); }
.agent svg { width: 110px; height: 110px; overflow: visible; }
.agent .nm { font-weight: 700; font-size: 14px; }
.agent .role { font-size: 11px; color: #b4bce0; }
.agent .st { font-size: 12px; margin-top: 4px; padding: 3px 9px; border-radius: 999px; background: rgba(255,255,255,.1); color: #e7eaf7; }
.agent .st.busy { background: rgba(46,229,157,.18); color: #8ef0c6; }
.agent .st.idle { background: rgba(255,255,255,.08); color: #b4bce0; }
.agent .st.paused { background: rgba(255,120,120,.18); color: #ffb3b3; }
.agent .num { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.agent .num small { font-size: 11px; font-weight: 500; color: #b4bce0; margin-left: 4px; }
.agent .tip2 { position: absolute; left: 8px; right: 8px; top: 8px; background: #fff; color: var(--fg); font-size: 12px; padding: 8px 10px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.3); opacity: 0; text-align: left; line-height: 1.4; pointer-events: none; transition: opacity .15s; z-index: 3; }
.agent:hover .tip2 { opacity: 1; }
.bob { animation: bob 2.6s ease-in-out infinite; transform-origin: 50% 100%; }
.agent[data-state=idle] .bob { animation-duration: 4s; }
.agent[data-state=paused] .bob { animation: none; opacity: .6; }
.blink { animation: blink 4s infinite; transform-origin: center; }
.arm { transform-origin: 72px 70px; animation: wave 1.2s ease-in-out infinite; }
.agent[data-state=idle] .arm, .agent[data-state=paused] .arm { animation: none; }
.env { animation: fly 2.4s ease-in infinite; opacity: 0; }
.agent[data-state=busy] .env { opacity: 1; }
.ring { transform-origin: 85px 24px; animation: ring .9s ease-in-out infinite; }
.agent[data-state=idle] .ring, .agent[data-state=paused] .ring { animation: none; }
.scan { animation: scan 2s ease-in-out infinite; }
.agent[data-state=idle] .scan, .agent[data-state=paused] .scan { animation: none; }
.zz { opacity: 0; }
.agent[data-state=idle] .zz { animation: zz 3s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-4px) } }
@keyframes blink { 0%,92%,100% { transform: scaleY(1) } 95% { transform: scaleY(.1) } }
@keyframes wave { 0%,100% { transform: rotate(-8deg) } 50% { transform: rotate(14deg) } }
@keyframes fly { 0% { transform: translate(0,0); opacity: 0 } 15% { opacity: 1 } 100% { transform: translate(60px,-48px); opacity: 0 } }
@keyframes ring { 0%,100% { transform: rotate(-12deg) } 50% { transform: rotate(12deg) } }
@keyframes scan { 0%,100% { transform: translateX(-10px) } 50% { transform: translateX(10px) } }
@keyframes zz { 0% { transform: translate(0,0); opacity: 0 } 30% { opacity: 1 } 100% { transform: translate(14px,-22px); opacity: 0 } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(46,229,157,.6) } 70% { box-shadow: 0 0 0 8px rgba(46,229,157,0) } 100% { box-shadow: 0 0 0 0 rgba(46,229,157,0) } }
@media (prefers-reduced-motion: reduce) { .bob, .blink, .arm, .env, .ring, .scan, .zz, .live i { animation: none !important; } .env { opacity: 1 } }

.engine-box { margin-top: 10px; border-radius: 12px; background: radial-gradient(900px 300px at 50% 0%, #10226b 0%, #070b33 70%); border: 1px solid rgba(255,255,255,.08); overflow: hidden; }
.engine-box canvas { width: 100%; display: block; }
.floor { margin-top: 12px; }
.floor .agent svg { width: 64px; height: 64px; }
.floor .agent { padding: 8px; gap: 2px; }
.floor .agent .num { font-size: 18px; }

.badge { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; text-align: center; margin-left: 4px; }
.btn.google { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; margin-top: 10px; font-weight: 600; }
.drafts { display: grid; gap: 12px; }
.draft { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 8px; }
.draft .top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.draft .who b { font-size: 15px; }
.draft .brief { background: #f3f5fc; border-left: 3px solid var(--accent); padding: 8px 10px; border-radius: 6px; font-size: 13px; color: #3a3f5c; }
.draft .brief .lab { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); display: block; margin-bottom: 2px; }
.draft input.subj { font-weight: 600; }
.draft textarea { min-height: 150px; line-height: 1.5; }
.draft .foot { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.draft .foot .spacer { flex: 1; }
.btn.ok { background: var(--ok); color: #fff; border-color: var(--ok); font-weight: 600; }
.btn.warn { color: var(--bad); }
.reply-text { white-space: pre-wrap; background: #fffbea; border-left: 3px solid #ffd166; padding: 8px 10px; border-radius: 6px; font-size: 13px; }
.cls { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.cls.INTERESTED { background: #e1f7ed; color: #146c4f; } .cls.NOT_INTERESTED { background: #fde8e6; color: #9b2c22; } .cls.OTHER { background: #eef0f7; color: #4a5070; }
.angle-row { display: grid; grid-template-columns: 1.2rem 1fr; gap: 8px; align-items: start; margin-bottom: 8px; }
.angle-row b { padding-top: 8px; }
.angle-stats { font-size: 12px; color: var(--muted); margin: 4px 0 10px; }
.angle-stats .win { color: var(--ok); font-weight: 600; }
.dnsok { color: var(--ok); font-weight: 700; } .dnsbad { color: var(--bad); font-weight: 700; }
code.rec { font-size: 11px; color: var(--muted); word-break: break-all; }

.draft .who { color: var(--fg); }

.split { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
.detail { position: sticky; top: 12px; }
.detail h2 { font-size: 18px; }
.detail .sub { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.detail .two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.tl { list-style: none; padding: 0; margin: 12px 0 0; border-left: 2px solid var(--line); }
.tl li { position: relative; padding: 4px 0 10px 16px; font-size: 13px; }
.tl li::before { content: ""; position: absolute; left: -6px; top: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--c1); }
.tl li.reply_received::before { background: #ffd166; } .tl li.booked::before { background: var(--ok); } .tl li.bounce::before { background: var(--bad); } .tl li.reply_sent::before { background: var(--c2); } .tl li.status_change::before, .tl li.note::before { background: var(--muted); }
.tl .when { color: var(--muted); font-size: 11px; }
tr.sel td { background: #eef1fd; }
#cust-table tr { cursor: pointer; }

/* research */
.pill { display: inline-block; font-size: 11px; padding: 2px 9px; border-radius: 999px; background: #e9eaf0; color: #444; font-weight: 600; }
.pill.ok { background: #dff3ea; color: #1f8a70; }
.pill.warn { background: #fff1d6; color: #9a6400; }
.row.between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.research-card h2 { margin: 0; text-transform: capitalize; }
.research-card p { margin: 8px 0; }
.score { display: inline-block; min-width: 34px; text-align: center; font-weight: 700; font-size: 12px; padding: 2px 6px; border-radius: 6px; background: #eceef5; color: #555; }
.score.s1 { background: #fff1d6; color: #9a6400; }
.score.s2 { background: #e2e8ff; color: #2a44c8; }
.score.s3, .score.s4 { background: #dff3ea; color: #1f8a70; }
