:root{
  --bg:#0f172a; --panel:#ffffff; --ink:#1e293b; --muted:#64748b;
  --line:#e2e8f0; --brand:#1d4ed8; --brand-ink:#fff;
  --ok:#166534; --ok-bg:#dcfce7; --err:#991b1b; --err-bg:#fee2e2;
  --warn:#92400e; --warn-bg:#fef3c7;
}
*{box-sizing:border-box}
body{margin:0;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;
  color:var(--ink);background:#f1f5f9;line-height:1.5}
a{color:var(--brand);text-decoration:none}
a:hover{text-decoration:underline}

.topbar{display:flex;align-items:center;justify-content:space-between;
  background:var(--bg);color:#e2e8f0;padding:.7rem 1.2rem;flex-wrap:wrap;gap:.5rem}
.topbar .brand{color:#fff;font-weight:700;font-size:1.05rem}
.topbar nav{display:flex;align-items:center;gap:1rem;flex-wrap:wrap}
.topbar nav a{color:#cbd5e1}
.topbar nav a:hover{color:#fff}
.who{color:#94a3b8;font-size:.9rem}
.role{font-size:.7rem;text-transform:uppercase;padding:.1rem .4rem;border-radius:4px;
  margin-left:.25rem}
.role-agent{background:#334155;color:#cbd5e1}
.role-processor{background:#0e7490;color:#fff}
.role-admin{background:#7c3aed;color:#fff}
.bell{position:relative;text-decoration:none}
.bell-badge{position:absolute;top:-8px;right:-10px;background:#ef4444;color:#fff;
  font-size:.65rem;font-weight:700;min-width:16px;height:16px;line-height:16px;
  text-align:center;border-radius:999px;padding:0 4px}
.notif-list{list-style:none;margin:0;padding:0}
.notif-item{padding:.7rem .2rem;border-bottom:1px solid var(--line)}
.notif-item:last-child{border-bottom:none}
.notif-item.unread{background:#eff6ff;border-radius:8px;padding-left:.6rem}
.notif-msg{font-size:.95rem}
.notif-time{font-size:.78rem;color:var(--muted);margin-top:.15rem}
.inline{display:inline;margin:0}
.linkbtn{background:none;border:none;color:#cbd5e1;cursor:pointer;font:inherit;padding:0}
.linkbtn:hover{color:#fff;text-decoration:underline}

.wrap{max-width:900px;margin:1.5rem auto;padding:0 1rem}
.foot{text-align:center;color:var(--muted);font-size:.8rem;padding:2rem 1rem}

/* Layout utilities (replace inline styles so the strict CSP needs no
   'unsafe-inline' for style attributes). */
.narrow{max-width:560px;margin-left:auto;margin-right:auto}
.row-between{display:flex;justify-content:space-between;align-items:center;
  flex-wrap:wrap;gap:1rem}
.m0{margin:0}
.mt1{margin-top:1rem}
.mb1{margin-bottom:1rem}

.card{background:var(--panel);border:1px solid var(--line);border-radius:12px;
  padding:1.4rem;margin-bottom:1.2rem;box-shadow:0 1px 2px rgba(0,0,0,.04)}
.card.awaiting{border-left:4px solid #f59e0b;background:#fffbeb}
.card.awaiting h2{color:#92400e}
.card.awaiting .muted{color:#7c3d0a}
.card.awaiting .btn{background:linear-gradient(135deg,#f59e0b,#d97706);
  color:#fff;border:none}
.btn.btn-sm{padding:.4rem .8rem;font-size:.85rem}
form.inline{display:inline;margin:0}
h1{font-size:1.5rem;margin:.2rem 0 1rem}
h2{font-size:1.15rem;margin:0 0 .8rem}
.muted{color:var(--muted)}
.hero{background:linear-gradient(135deg,#1e3a8a,#1d4ed8);color:#fff;border:none}
.hero p{color:#dbeafe;max-width:52ch}

.btn{display:inline-block;background:var(--brand);color:var(--brand-ink);
  border:none;border-radius:8px;padding:.6rem 1.1rem;font:inherit;cursor:pointer}
.btn:hover{background:#1e40af;text-decoration:none}
.btn-light{background:#fff;color:var(--brand);border:1px solid var(--brand)}
.btn-danger{background:#b91c1c}
.btn-danger:hover{background:#991b1b}
.btn-sm{padding:.35rem .7rem;font-size:.85rem}

label{display:block;font-weight:600;margin:.8rem 0 .3rem;font-size:.9rem}
input,select,textarea{width:100%;padding:.55rem .7rem;border:1px solid var(--line);
  border-radius:8px;font:inherit;background:#fff}
input:focus,select:focus,textarea:focus{outline:2px solid #bfdbfe;border-color:var(--brand)}
textarea{min-height:90px;resize:vertical}
.hint{font-size:.8rem;color:var(--muted);margin-top:.2rem}
.price-row{display:flex;align-items:center;gap:.4rem}
.price-row .cur{font-weight:700;color:var(--muted)}
.price-row input{max-width:160px}
.sep{border:none;border-top:1px solid var(--line);margin:1.2rem 0}
.msg-thread{display:flex;flex-direction:column;gap:.6rem;margin-bottom:.5rem}
.msg{border:1px solid var(--line);border-radius:10px;padding:.6rem .8rem;max-width:85%}
.msg-staff{align-self:flex-start;background:#eff6ff;border-color:#dbeafe}
.msg-agent{align-self:flex-start;background:#f8fafc}
.msg-mine{align-self:flex-end;background:#e7f0ff;border-color:#cfe0ff}
.msg-meta{font-size:.75rem;color:var(--muted);margin-bottom:.25rem}
.msg-body{font-size:.93rem;white-space:pre-wrap}
/* WhatsApp-style delivery ticks (only on your own messages) */
.ticks{display:flex;justify-content:flex-end;margin-top:.15rem;line-height:1;font-size:.8rem}
.ticks .tk{letter-spacing:-2px}
.tick-sent{color:#9aa6b6}
.tick-delivered{color:#9aa6b6}
.tick-read{color:#2f7bf6}
/* Online presence in the conversation header */
.presence{display:flex;align-items:center;gap:.4rem;margin:.35rem 0 .1rem}
.presence .pdot{width:9px;height:9px;border-radius:50%;flex:0 0 auto}
.presence .pdot.on{background:#22c55e;box-shadow:0 0 0 3px rgba(34,197,94,.2)}
.presence .pdot.off{background:#c2ccd8}
.presence .pname{font-weight:600;font-size:.9rem}
.presence .pstate{font-size:.82rem;color:var(--muted)}
.danger-link{color:#b91c1c}
/* Fees grid */
.fees-scroll{overflow-x:auto;margin:.5rem 0}
.fees-table{min-width:640px}
.fees-table th{white-space:nowrap}
.fees-table .sticky-col{position:sticky;left:0;background:var(--panel);z-index:1}
.fee-cell{display:flex;align-items:center;gap:.25rem}
.fee-cell .cur{color:var(--muted);font-size:.85rem}
.fee-cell input{width:90px;padding:.4rem .5rem}
/* Live feed */
.live-dot{display:inline-block;width:8px;height:8px;border-radius:50%;background:#22c55e;
  margin-right:.35rem;animation:livepulse 1.6s ease-in-out infinite}
@keyframes livepulse{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.4;transform:scale(.7)}}
.live-tag{font-size:.7rem;font-weight:700;color:#16a34a;letter-spacing:.05em}
@media(prefers-reduced-motion:reduce){.live-dot{animation:none}}
.actions{margin-top:1.2rem;display:flex;gap:.6rem;flex-wrap:wrap}

.flashes{margin-bottom:1rem}
.flash{padding:.7rem 1rem;border-radius:8px;margin-bottom:.5rem;font-size:.92rem}
.flash-success{background:var(--ok-bg);color:var(--ok)}
.flash-error{background:var(--err-bg);color:var(--err)}

table{width:100%;border-collapse:collapse;font-size:.92rem}
th,td{text-align:left;padding:.6rem .5rem;border-bottom:1px solid var(--line)}
th{color:var(--muted);font-size:.78rem;text-transform:uppercase;letter-spacing:.03em}
tr:hover td{background:#f8fafc}

.badge{display:inline-block;padding:.15rem .55rem;border-radius:999px;font-size:.75rem;
  font-weight:600}
.s-pending{background:#fef9c3;color:#854d0e}
.s-done{background:#dcfce7;color:#166534}
.s-hold{background:#fee2e2;color:#991b1b}
.hold-banner{display:flex;gap:.7rem;align-items:flex-start;background:#fef2f2;
  border:1px solid #fecaca;border-left:4px solid #dc2626;border-radius:10px;
  padding:.9rem 1rem;margin-bottom:1rem;color:#991b1b}
.hold-banner .hb-icon{font-size:1.2rem;line-height:1.3}
.hold-banner .hb-reason{margin-top:.25rem;color:#7f1d1d;white-space:pre-wrap}
.hold-banner .hb-sub{margin-top:.3rem;font-size:.88rem;color:#b91c1c}

.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:1rem}
.stat{background:#f8fafc;border:1px solid var(--line);border-radius:10px;padding:1rem;
  text-align:center}
.stat .n{font-size:1.8rem;font-weight:700;color:var(--brand)}
.stat .l{font-size:.8rem;color:var(--muted)}

.kv{display:grid;grid-template-columns:180px 1fr;gap:.4rem .8rem;font-size:.93rem}
.kv dt{color:var(--muted);font-weight:600}
.kv dd{margin:0}
.pii{font-family:ui-monospace,Menlo,monospace}

.timeline{list-style:none;padding:0;margin:0}
.timeline li{border-left:2px solid var(--line);padding:.2rem 0 1rem 1rem;position:relative}
.timeline li::before{content:"";position:absolute;left:-6px;top:.35rem;width:10px;
  height:10px;border-radius:50%;background:var(--brand)}
.timeline .meta{font-size:.8rem;color:var(--muted)}

.tag{font-size:.78rem;color:var(--muted)}
.right{text-align:right}
.filters{display:flex;gap:.4rem;flex-wrap:wrap;margin-bottom:1rem}
.filters a{padding:.3rem .7rem;border:1px solid var(--line);border-radius:999px;
  font-size:.82rem;color:var(--ink);background:#fff}
.filters a.on{background:var(--brand);color:#fff;border-color:var(--brand)}
.filter-label{font-size:.8rem;color:var(--muted);font-weight:600;align-self:center}
.searchbar{display:flex;gap:.5rem;margin-bottom:1rem;flex-wrap:wrap}
.searchbar input{flex:1;min-width:200px}
/* ===================== Premium staff dashboard ===================== */
:root{
  --done:#0ca30c; --done-soft:#e7f7e7;
  --pending:#f59e0b; --pending-soft:#fef3c7;
  --agent:#7c3aed; --agent-soft:#f1eafe;
  --brand-soft:#e6effe;
}
.dash{display:flex;flex-direction:column;gap:1.1rem}

@keyframes rise{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:none}}
@keyframes ringspin{from{stroke-dashoffset:327}}
.reveal{animation:rise .6s cubic-bezier(.2,.7,.2,1) both}
.d1{animation-delay:.06s}.d2{animation-delay:.13s}
.d3{animation-delay:.2s}.d4{animation-delay:.27s}

/* Hero */
.dash-hero{display:flex;justify-content:space-between;align-items:center;gap:1rem;
  flex-wrap:wrap;background:
    radial-gradient(120% 160% at 100% 0%, rgba(124,58,237,.35), transparent 55%),
    linear-gradient(135deg,#1e3a8a 0%,#1d4ed8 55%,#2563eb 100%);
  color:#fff;border-radius:16px;padding:1.6rem 1.8rem;
  box-shadow:0 12px 30px -12px rgba(29,78,216,.5)}
.dash-eyebrow{text-transform:uppercase;letter-spacing:.12em;font-size:.72rem;
  color:#bfdbfe;font-weight:700;margin-bottom:.2rem}
.dash-hero h1{margin:0 0 .25rem;font-size:1.7rem;color:#fff}
.dash-hero p{margin:0;color:#dbeafe;font-size:.95rem}
.dash-hero-metric{text-align:right;min-width:120px}
.hm-num{font-size:2.6rem;font-weight:800;line-height:1;letter-spacing:-.02em;
  font-variant-numeric:tabular-nums}
.hm-label{text-transform:uppercase;letter-spacing:.1em;font-size:.7rem;color:#bfdbfe;
  margin-top:.2rem}

/* KPI tiles */
.kpi-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:1rem}
.kpi{position:relative;overflow:hidden;background:var(--panel);border:1px solid var(--line);
  border-radius:14px;padding:1.1rem 1.2rem;text-decoration:none;color:var(--ink);
  transition:transform .25s cubic-bezier(.2,.7,.2,1),box-shadow .25s,border-color .25s}
.kpi::after{content:"";position:absolute;left:0;top:0;bottom:0;width:4px;background:var(--brand)}
.kpi:hover{transform:translateY(-4px);box-shadow:0 16px 30px -18px rgba(15,23,42,.4);
  border-color:#cbd5e1;text-decoration:none}
.kpi-top{display:flex;align-items:center;gap:.45rem;font-size:.82rem;color:var(--muted);
  font-weight:600}
.kpi-dot{width:9px;height:9px;border-radius:50%;display:inline-block}
.dot-brand{background:var(--brand)} .dot-pending{background:var(--pending)}
.dot-done{background:var(--done)} .dot-agent{background:var(--agent)}
.kpi:nth-child(2)::after{background:var(--pending)}
.kpi:nth-child(3)::after{background:var(--done)}
.kpi:nth-child(4)::after{background:var(--agent)}
.kpi-num{font-size:2.2rem;font-weight:800;letter-spacing:-.02em;margin:.35rem 0 .1rem;
  font-variant-numeric:tabular-nums}
.kpi-sub{font-size:.78rem;color:var(--muted)}

/* Panels grid */
.dash-grid{display:grid;grid-template-columns:1.6fr 1fr;gap:1.1rem}
@media(max-width:760px){.dash-grid{grid-template-columns:1fr}}
.panel{background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:1.3rem}
.panel-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:1rem}
.panel-head h2{margin:0;font-size:1.05rem}
.panel-link{font-size:.82rem}

/* Horizontal bars */
.bars{display:flex;flex-direction:column;gap:.7rem}
.bar-row{display:grid;grid-template-columns:130px 1fr 34px;align-items:center;gap:.7rem}
.bar-label{font-size:.85rem;color:var(--ink)}
.bar-track{height:12px;background:#eef2f7;border-radius:999px;overflow:hidden}
.bar-fill{height:100%;width:0;border-radius:999px;
  background:linear-gradient(90deg,#3b82f6,#1d4ed8)}
.bar-val{font-size:.85rem;font-weight:700;text-align:right;font-variant-numeric:tabular-nums}

/* Completion ring */
.ring-wrap{position:relative;width:170px;height:170px;margin:.4rem auto .8rem}
.ring{width:170px;height:170px;transform:rotate(-90deg)}
.ring-track{fill:none;stroke:var(--pending-soft);stroke-width:12}
.ring-value{fill:none;stroke:var(--done);stroke-width:12;stroke-linecap:round;
  stroke-dasharray:327;stroke-dashoffset:327;
  transition:stroke-dashoffset 1.2s cubic-bezier(.2,.7,.2,1)}
.ring-center{position:absolute;inset:0;display:flex;flex-direction:column;
  align-items:center;justify-content:center}
.ring-pct{font-size:2rem;font-weight:800;letter-spacing:-.02em;font-variant-numeric:tabular-nums}
.ring-cap{font-size:.72rem;text-transform:uppercase;letter-spacing:.1em;color:var(--muted)}
.ring-legend{display:flex;justify-content:center;gap:1.4rem}
.lg{font-size:.85rem;color:var(--muted);display:flex;align-items:center;gap:.4rem}
.lg b{color:var(--ink);font-variant-numeric:tabular-nums}
.lg-dot{width:10px;height:10px;border-radius:3px;display:inline-block}

/* Activity feed */
.feed{list-style:none;margin:0;padding:0;display:flex;flex-direction:column}
.feed-item{display:flex;align-items:center;gap:.7rem;padding:.6rem 0;
  border-bottom:1px solid var(--line);flex-wrap:wrap}
.feed-item:last-child{border-bottom:none}
.feed-badge{font-size:.7rem;font-weight:700;padding:.12rem .5rem;border-radius:999px}
.feed-ref{font-weight:700}
.feed-type{font-size:.85rem;color:var(--ink)}
.feed-agent{font-size:.82rem;color:var(--muted)}
.feed-time{margin-left:auto;font-size:.78rem;color:var(--muted);
  font-variant-numeric:tabular-nums}

/* Quick actions */
.quick{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:.8rem}
.qbtn{display:flex;align-items:center;gap:.6rem;background:var(--panel);
  border:1px solid var(--line);border-radius:12px;padding:.9rem 1.1rem;color:var(--ink);
  font-weight:600;text-decoration:none;transition:transform .2s,box-shadow .2s,border-color .2s}
.qbtn span{font-size:1.2rem}
.qbtn:hover{transform:translateY(-3px);box-shadow:0 12px 24px -16px rgba(15,23,42,.4);
  border-color:#cbd5e1;text-decoration:none}

@media(prefers-reduced-motion:reduce){
  .reveal{animation:none}
  .bar-fill,.ring-value{transition:none}
  .kpi:hover,.qbtn:hover{transform:none}
}

.copybtn{margin-left:.5rem;font-size:.72rem;padding:.15rem .5rem;border:1px solid var(--line);
  border-radius:6px;background:#f8fafc;color:var(--brand);cursor:pointer;font-family:system-ui}
.copybtn:hover{background:#eff6ff}
.copybtn.copied{background:var(--ok-bg);color:var(--ok);border-color:var(--ok-bg)}
.errpage{text-align:center;padding:3rem 1rem}
.errpage .code{font-size:3rem;font-weight:800;color:var(--brand)}

/* ===================== MOMO payment notice ===================== */
.momo-notice{display:flex;align-items:center;gap:1rem;
  background:
    radial-gradient(120% 160% at 0% 0%, rgba(255,255,255,.55), transparent 60%),
    linear-gradient(135deg,#fffbeb 0%,#fef3c7 55%,#fde68a 100%);
  border:1px solid #fcd34d;border-radius:16px;padding:1.1rem 1.3rem;
  box-shadow:0 12px 30px -16px rgba(217,119,6,.45)}
.momo-notice .mn-icon{flex:0 0 auto;display:flex;align-items:center;justify-content:center;
  width:46px;height:46px;border-radius:50%;font-size:1.35rem;
  background:linear-gradient(135deg,#fbbf24,#d97706);
  box-shadow:0 6px 14px -4px rgba(217,119,6,.6)}
.momo-notice .mn-body{min-width:0}
.momo-notice .mn-title{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;
  font-weight:800;color:#92400e;font-size:1.02rem;letter-spacing:-.01em;margin-bottom:.15rem}
.momo-notice .mn-pill{font-size:.62rem;font-weight:800;text-transform:uppercase;
  letter-spacing:.08em;color:#fff;background:#d97706;padding:.14rem .5rem;border-radius:999px}
.momo-notice .mn-text{color:#7c3d0a;font-size:.94rem;line-height:1.45}
.momo-notice .mn-text strong{color:#92400e;font-weight:800}
@media(max-width:520px){.momo-notice{align-items:flex-start}}
/* Green "active / working" variant */
.momo-notice.active{border-color:#86efac;box-shadow:0 12px 30px -16px rgba(22,101,52,.4);
  background:
    radial-gradient(120% 160% at 0% 0%, rgba(255,255,255,.6), transparent 60%),
    linear-gradient(135deg,#f0fdf4 0%,#dcfce7 55%,#bbf7d0 100%)}
.momo-notice.active .mn-icon{background:linear-gradient(135deg,#34d399,#16a34a);
  box-shadow:0 6px 14px -4px rgba(22,101,52,.55)}
.momo-notice.active .mn-title{color:#166534}
.momo-notice.active .mn-pill{background:#16a34a}
.momo-notice.active .mn-text{color:#14532d}
.momo-notice.active .mn-text strong{color:#166534}

/* ===================== Messages inbox ===================== */
.inbox{display:grid;grid-template-columns:320px 1fr;gap:1.1rem;align-items:start}
.inbox-list{display:flex;flex-direction:column;gap:.5rem;max-height:74vh;overflow-y:auto;
  padding-right:.2rem}
.conv{display:block;text-decoration:none;color:var(--ink);border:1px solid var(--line);
  border-radius:12px;padding:.7rem .85rem;background:var(--panel);
  transition:border-color .2s,box-shadow .2s}
.conv:hover{border-color:#cbd5e1;box-shadow:0 8px 20px -16px rgba(15,23,42,.4);text-decoration:none}
.conv.active{border-color:var(--brand);box-shadow:0 0 0 1px var(--brand) inset}
.conv-top{display:flex;justify-content:space-between;align-items:baseline;gap:.5rem}
.conv-ref{font-weight:700}
.conv-time{font-size:.74rem;color:var(--muted);white-space:nowrap}
.conv-agent{font-size:.8rem;color:var(--muted);margin:.1rem 0 .2rem}
.conv-snip{font-size:.85rem;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.conv.unread .conv-ref::before{content:"";display:inline-block;width:8px;height:8px;
  border-radius:50%;background:var(--brand);margin-right:.4rem;vertical-align:middle}
.conv.unread .conv-snip{font-weight:600;color:var(--ink)}
/* Chat pane: header fixed at top, messages scroll, reply pinned at bottom. */
.inbox-main{border:1px solid var(--line);border-radius:14px;padding:1.1rem 1.2rem;
  background:var(--panel);height:74vh;display:flex;flex-direction:column;gap:.7rem;overflow:hidden}
.inbox-main .conv-head{flex:0 0 auto}
.inbox-main .msg-thread{flex:1 1 auto;overflow-y:auto;margin:0;padding-right:.3rem}
.inbox-main > form{flex:0 0 auto;margin-top:.2rem;border-top:1px solid var(--line);padding-top:.7rem}
.inbox-main > form label{margin-top:0}
.inbox-main > form textarea{min-height:56px}
.conv-head{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;
  border-bottom:1px solid var(--line);padding-bottom:.6rem}
.conv-back{display:none;font-weight:600;font-size:.9rem}
.inbox-empty{display:flex;align-items:center;justify-content:center;flex:1;text-align:center}

/* --- Mobile: one screen at a time, like a chat app. --- */
@media(max-width:760px){
  .inbox{display:block}
  /* No conversation open: show the list only. */
  .inbox:not(.has-selection) .inbox-main{display:none}
  .inbox-list{max-height:none;overflow:visible}
  /* Conversation open: hide the list, thread fills the screen. */
  .inbox.has-selection .inbox-list{display:none}
  .inbox.has-selection .inbox-main{display:flex;height:calc(100vh - 96px)}
  .conv-back{display:inline-block}
  .conv{padding:.85rem .9rem}
  /* When a chat is open on mobile, hide the page header/padding for a
     full-screen chat (browsers without :has() simply keep the header). */
  .dash:has(.inbox.has-selection) .dash-hero{display:none}
  .dash:has(.inbox.has-selection) > .card{padding:.5rem;margin-bottom:0}
  .dash:has(.inbox.has-selection) .inbox.has-selection .inbox-main{height:calc(100vh - 40px)}
}

/* ===================== Premium nav bar ===================== */
.topbar{position:sticky;top:0;z-index:50;
  background:linear-gradient(90deg,#0b1220 0%,#0f172a 55%,#122142 100%);
  box-shadow:0 2px 14px rgba(2,6,23,.45);border-bottom:1px solid rgba(148,163,184,.12)}
.topbar nav a.navlink{padding:.4rem .75rem;border-radius:9px;font-size:.92rem;color:#cbd5e1;
  transition:background .2s,color .2s}
.topbar nav a.navlink:hover{background:rgba(255,255,255,.08);color:#fff;text-decoration:none}
.topbar nav a.navlink.on{color:#fff;
  background:linear-gradient(135deg,rgba(59,130,246,.30),rgba(37,99,235,.30));
  box-shadow:inset 0 0 0 1px rgba(96,165,250,.40)}
.nav-badge{display:inline-block;min-width:17px;height:17px;line-height:17px;text-align:center;
  font-size:.66rem;font-weight:800;background:var(--brand);color:#fff;border-radius:999px;
  padding:0 5px;margin-left:.35rem;vertical-align:middle}
.topbar nav a.bell{padding:.3rem .45rem;border-radius:9px}
.topbar nav a.bell:hover{background:rgba(255,255,255,.08)}
.who{padding:.3rem .55rem;border-radius:9px}
.who:hover{background:rgba(255,255,255,.06);text-decoration:none}

/* ===================== New-order sub-options ===================== */
.subopt{display:none;margin:.2rem 0 .2rem}
.radio-row{display:flex;flex-wrap:wrap;gap:.5rem;margin-top:.2rem}
.radio-row .radio{display:inline-flex;align-items:center;gap:.4rem;margin:0;
  font-weight:500;border:1px solid var(--line);border-radius:10px;
  padding:.5rem .8rem;cursor:pointer;background:#fff;transition:border-color .15s,background .15s}
.radio-row .radio:hover{border-color:#cbd5e1}
.radio-row .radio input{width:auto;margin:0}
.form-note{display:flex;align-items:center;gap:.4rem;margin-top:.35rem;
  background:var(--warn-bg);color:#92400e;border:1px solid #fcd34d;
  border-radius:8px;padding:.5rem .7rem;font-size:.85rem;font-weight:600}
.form-note.info{background:#eff6ff;color:#1e3a8a;border-color:#bfdbfe}

/* ---- Maintenance page (styles here because CSP blocks inline <style>) ---- */
.maint-wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:1.5rem}
.maint-card{max-width:520px;width:100%;background:var(--panel,#fff);
  border:1px solid var(--line,#e5e7eb);border-radius:16px;padding:2.4rem;
  text-align:center;box-shadow:0 20px 50px -24px rgba(0,0,0,.3)}
.maint-icon{font-size:2.6rem;margin-bottom:.4rem}
.maint-badge{display:inline-flex;align-items:center;gap:.5rem;font-weight:800;
  font-size:.72rem;text-transform:uppercase;letter-spacing:.05em;color:#92400e;
  background:#fef3c7;border:1px solid #fde68a;padding:.35rem .7rem;
  border-radius:999px;margin-bottom:1.1rem}
.maint-card h1{font-size:1.6rem;margin:.2rem 0 .8rem}
.maint-card p{color:#4b5563;line-height:1.55;margin:.4rem 0}
.txn-input{width:auto;max-width:150px;display:inline-block;margin-right:.4rem;
  padding:.35rem .5rem;font-size:.85rem}

/* Agent notice banner (admin-managed announcement) */
.agent-notice{display:flex;align-items:flex-start;gap:.6rem;background:#eff6ff;
  border:1px solid #bfdbfe;border-left:4px solid #2563eb;border-radius:10px;
  padding:.8rem 1rem;margin-bottom:1rem;color:#1e3a8a}
.agent-notice .an-icon{flex:0 0 auto;font-size:1.1rem;line-height:1.4}
.agent-notice .an-text{line-height:1.5;white-space:pre-wrap}

/* Big red emergency banner — can't-miss alert on every agent page. */
.emergency-banner{display:flex;align-items:center;gap:1rem;
  background:linear-gradient(180deg,#b91c1c,#991b1b);color:#fff;
  border:2px solid #7f1d1d;border-radius:12px;
  padding:1.1rem 1.25rem;margin-bottom:1.2rem;
  box-shadow:0 12px 30px -12px rgba(185,28,28,.6);
  animation:eb-pulse 1.6s ease-in-out infinite}
.emergency-banner .eb-icon{flex:0 0 auto;font-size:2rem;line-height:1;
  filter:drop-shadow(0 1px 2px rgba(0,0,0,.4))}
.emergency-banner .eb-body{flex:1 1 auto;min-width:0}
.emergency-banner .eb-title{font-weight:800;letter-spacing:.06em;
  text-transform:uppercase;font-size:.8rem;opacity:.9;margin-bottom:.15rem}
.emergency-banner .eb-text{font-weight:700;font-size:1.05rem;line-height:1.45;
  white-space:pre-wrap}
@keyframes eb-pulse{
  0%,100%{box-shadow:0 12px 30px -12px rgba(185,28,28,.55);
    border-color:#7f1d1d}
  50%{box-shadow:0 14px 40px -10px rgba(239,68,68,.85);
    border-color:#ef4444}}
@media (prefers-reduced-motion:reduce){
  .emergency-banner{animation:none}}

.queue-toolbar{display:flex;align-items:center;gap:.6rem;flex-wrap:wrap;margin:.2rem 0 1rem}
.queue-toolbar .hint{margin-top:0}
.kpi-link{text-decoration:none;color:inherit;display:block;transition:transform .12s ease,box-shadow .12s ease}
.kpi-link:hover{text-decoration:none;transform:translateY(-2px);box-shadow:0 10px 24px -16px rgba(0,0,0,.35)}

/* ===== Daily Blessing — premium card with a live, burning fire ===== */
.motivation{position:relative;overflow:hidden;isolation:isolate;border-radius:16px;
  padding:1.7rem 1.6rem;margin-bottom:1.1rem;color:#fff;
  background:radial-gradient(150% 150% at 50% 128%, #6e1500 0%, #3a0d20 40%,
    #1a0a2a 72%, #120726 100%);
  box-shadow:0 20px 46px -20px rgba(190,40,0,.7),inset 0 0 0 1px rgba(255,255,255,.09)}
/* Warm base glow rising from the bottom */
.motivation::before{content:"";position:absolute;inset:auto 0 0 0;height:60%;z-index:-3;
  background:radial-gradient(90% 120% at 50% 130%,rgba(255,120,0,.55),
    rgba(255,60,0,0) 70%);animation:mo-glow 3.4s ease-in-out infinite}
@keyframes mo-glow{0%,100%{opacity:.75}50%{opacity:1}}
/* Live flames: nine tongues that flicker, sway and lick upward */
.mo-fire{position:absolute;inset:auto 0 0 0;height:82%;z-index:-2;pointer-events:none}
.flame{position:absolute;bottom:-8%;width:15%;height:70%;transform-origin:50% 100%;
  border-radius:50% 50% 46% 46% / 66% 66% 38% 38%;filter:blur(7px);
  mix-blend-mode:screen;opacity:.9;
  background:radial-gradient(closest-side at 50% 82%,#fff4bf 0%,#ffd24d 20%,
    #ff9a00 44%,#ff4d00 66%,rgba(255,60,0,0) 80%);
  animation:mo-flame 1.7s ease-in-out infinite}
.mo-fire .flame:nth-child(1){left:-3%;animation-delay:0s}
.mo-fire .flame:nth-child(2){left:8%;height:82%;animation-delay:-.5s}
.mo-fire .flame:nth-child(3){left:20%;animation-delay:-1s}
.mo-fire .flame:nth-child(4){left:31%;height:88%;animation-delay:-.3s}
.mo-fire .flame:nth-child(5){left:43%;animation-delay:-.9s}
.mo-fire .flame:nth-child(6){left:55%;height:80%;animation-delay:-.2s}
.mo-fire .flame:nth-child(7){left:66%;animation-delay:-1.2s}
.mo-fire .flame:nth-child(8){left:78%;height:86%;animation-delay:-.6s}
.mo-fire .flame:nth-child(9){left:88%;animation-delay:-.15s}
@keyframes mo-flame{
  0%,100%{transform:translateY(2%) scaleY(1) scaleX(1) skewX(0);opacity:.82}
  20%{transform:translateY(-6%) scaleY(1.2) scaleX(.9) skewX(4deg);opacity:1}
  40%{transform:translateY(-1%) scaleY(.9) scaleX(1.1) skewX(-4deg);opacity:.8}
  60%{transform:translateY(-9%) scaleY(1.26) scaleX(.86) skewX(3deg);opacity:1}
  80%{transform:translateY(0) scaleY(.96) scaleX(1.06) skewX(-3deg);opacity:.85}}
/* Rising embers */
.ember{position:absolute;bottom:14%;width:5px;height:5px;border-radius:50%;
  background:radial-gradient(circle,#ffe9a8 0%,#ff8a00 60%,rgba(255,80,0,0) 100%);
  filter:blur(.4px);mix-blend-mode:screen;opacity:0;
  animation:mo-ember 3.4s linear infinite}
.mo-fire .ember:nth-child(10){left:14%;animation-delay:0s}
.mo-fire .ember:nth-child(11){left:30%;animation-delay:-.8s}
.mo-fire .ember:nth-child(12){left:48%;animation-delay:-1.6s}
.mo-fire .ember:nth-child(13){left:63%;animation-delay:-.4s}
.mo-fire .ember:nth-child(14){left:77%;animation-delay:-2.2s}
.mo-fire .ember:nth-child(15){left:90%;animation-delay:-1.2s}
@keyframes mo-ember{
  0%{transform:translate(0,0) scale(1);opacity:0}
  12%{opacity:.95}
  100%{transform:translate(14px,-130px) scale(.3);opacity:0}}
.mo-shine{position:absolute;inset:0;z-index:-1;pointer-events:none;mix-blend-mode:screen;
  background:repeating-linear-gradient(115deg,rgba(255,255,255,.06) 0 7px,
      rgba(255,255,255,0) 7px 22px),
    linear-gradient(180deg,rgba(255,255,255,.14),rgba(255,255,255,0) 42%)}
.mo-shine::after{content:"";position:absolute;top:0;left:-60%;width:55%;height:100%;
  transform:skewX(-18deg);animation:mo-shine 5.5s ease-in-out infinite;
  background:linear-gradient(100deg,rgba(255,255,255,0),rgba(255,255,255,.38),
    rgba(255,255,255,0))}
@keyframes mo-shine{0%{left:-60%}55%{left:125%}100%{left:125%}}
.mo-body{position:relative;z-index:1}
.mo-eyebrow{display:inline-flex;align-items:center;gap:.4rem;font-size:.72rem;
  font-weight:800;letter-spacing:.14em;text-transform:uppercase;color:#ffe9c7;
  background:rgba(0,0,0,.28);border:1px solid rgba(255,255,255,.2);
  padding:.3rem .75rem;border-radius:999px}
.mo-gem{filter:drop-shadow(0 0 6px rgba(130,205,255,.95))}
.mo-quote{margin:.85rem 0 0;font-size:1.4rem;line-height:1.4;font-weight:700;
  border:none;padding:0;max-width:48ch;text-shadow:0 2px 16px rgba(0,0,0,.5)}
.mo-author{margin-top:.55rem;font-size:.92rem;font-weight:600;color:#ffd9a8}
@media(max-width:520px){.mo-quote{font-size:1.14rem}}
@media(prefers-reduced-motion:reduce){
  .flame,.ember,.mo-shine::after,.motivation::before{animation:none}
  .ember{opacity:0}}

/* Enable-phone-alerts button in the top nav */
.pushbtn{border:1px solid var(--line,#334155);background:#eef4ff;color:#1e3a8a;
  border-radius:9px;padding:6px 12px;font-size:.85rem;font-weight:600;cursor:pointer;
  transition:background .15s,border-color .15s}
.pushbtn:hover{background:#e0ebff;border-color:#93b4ff}
.pushbtn.on{background:#dcfce7;color:#166534;border-color:#86efac;cursor:default}
.pushbtn:disabled{opacity:.9}

/* Guidance text shown next to the phone-alerts button */
.pushbtn.warn{background:#fef3c7;color:#92400e;border-color:#fde68a}
.push-hint{display:block;font-size:.78rem;color:#94a3b8;margin-top:.3rem;max-width:320px}

/* Restricted-agent notice on the dashboard */
.restricted-note{display:inline-block;background:rgba(255,255,255,.14);
  border:1px solid rgba(255,255,255,.35);color:#fff;border-radius:10px;
  padding:.7rem 1rem;margin-top:.4rem;font-weight:600;max-width:52ch}

/* Direct (order-less) "Message Admin" conversation in the inbox list */
.conv.conv-direct{border-color:#c7d2fe;background:#eef2ff}
.conv.conv-direct .conv-ref{color:#3730a3}

/* Chat image attachments */
.msg-img{display:block;max-width:230px;max-height:280px;width:auto;height:auto;
  border-radius:10px;margin:.15rem 0;cursor:pointer;border:1px solid var(--line)}
.msg-imglink{display:inline-block;line-height:0}
.reply-row{display:flex;align-items:center;gap:.6rem;margin-top:.5rem;flex-wrap:wrap}
.attach-input{display:none}
.attach-btn{display:inline-flex;align-items:center;gap:.35rem;cursor:pointer;
  border:1px solid var(--line);background:#f8fafc;border-radius:8px;
  padding:.5rem .8rem;font-weight:600;font-size:.9rem;color:var(--ink);margin:0}
.attach-btn:hover{border-color:var(--brand);color:var(--brand)}
.attach-name{font-size:.82rem;color:var(--muted);flex:1 1 auto;min-width:0;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.reply-row .btn{margin-left:auto}

/* Emoji picker (compose + react) */
.emoji-picker[hidden],.emoji-backdrop[hidden]{display:none!important}
.emoji-backdrop{position:fixed;inset:0;background:rgba(15,23,42,.28);z-index:55}
.emoji-picker{position:fixed;left:50%;bottom:16px;transform:translateX(-50%);
  z-index:70;width:min(360px,94vw);max-height:52vh;display:flex;flex-direction:column;
  background:var(--panel);border:1px solid var(--line);border-radius:14px;
  box-shadow:0 24px 60px -20px rgba(15,23,42,.5);overflow:hidden}
.emoji-head{display:flex;align-items:center;justify-content:space-between;
  padding:.5rem .7rem;border-bottom:1px solid var(--line)}
.emoji-title{font-weight:700;font-size:.9rem}
.emoji-close{border:none;background:#f1f5f9;border-radius:999px;width:30px;height:30px;
  font-size:.95rem;cursor:pointer;color:var(--ink);line-height:1;padding:0}
.emoji-close:hover{background:#e2e8f0}
.emoji-tabs{display:flex;gap:.2rem;overflow-x:auto;padding:.5rem;border-bottom:1px solid var(--line)}
.emoji-tab{flex:0 0 auto;border:none;background:transparent;border-radius:8px;
  padding:.35rem .6rem;font-size:.78rem;font-weight:600;color:var(--muted);cursor:pointer;white-space:nowrap}
.emoji-tab.on{background:#eef2ff;color:var(--brand)}
.emoji-grid{display:grid;grid-template-columns:repeat(8,1fr);gap:.1rem;
  overflow-y:auto;padding:.5rem}
.emoji-cell{border:none;background:transparent;cursor:pointer;font-size:1.5rem;
  line-height:1;padding:.3rem;border-radius:8px}
.emoji-cell:hover{background:#f1f5f9}
/* React button on a message + reaction chips */
.msg{position:relative}
.react-btn{position:absolute;top:-10px;right:-8px;border:1px solid var(--line);
  background:var(--panel);border-radius:999px;width:24px;height:24px;line-height:1;
  font-size:.8rem;cursor:pointer;opacity:0;transition:opacity .12s;padding:0;
  box-shadow:0 2px 6px -2px rgba(0,0,0,.3)}
.msg:hover .react-btn{opacity:1}
.reactions{display:flex;flex-wrap:wrap;gap:.25rem;margin-top:.3rem}
.reaction-chip{border:1px solid var(--line);background:#f8fafc;border-radius:999px;
  padding:.05rem .45rem;font-size:.8rem;cursor:pointer;line-height:1.4}
.reaction-chip.mine{background:#e0ebff;border-color:#93b4ff;color:#1e3a8a}
.big-emoji{font-size:2.6rem;line-height:1.15}
@media(max-width:760px){
  .react-btn{opacity:1}
  /* Emoji picker becomes a bottom sheet that never floats over the text box. */
  .emoji-picker{left:0;right:0;bottom:0;transform:none;width:100%;
    max-height:42vh;height:42vh;border-radius:16px 16px 0 0;border-bottom:none}
  .emoji-grid{grid-template-columns:repeat(7,1fr)}
  /* While the sheet is open, pin the reply box just above it so you can see
     what you're typing (like WhatsApp). */
  body.emoji-open .inbox-main > form{position:fixed;left:0;right:0;bottom:42vh;
    z-index:58;background:var(--panel);border-top:1px solid var(--line);
    padding:.6rem .8rem;margin:0;box-shadow:0 -6px 18px -12px rgba(0,0,0,.4)}
  body.emoji-open .inbox-main > form textarea{min-height:44px}
}

/* Bulk-select checkbox column on the queue */
.chkcol{width:34px;text-align:center}
.chkcol input{width:auto;margin:0;cursor:pointer;transform:scale(1.15)}

/* Admin: start a direct message with any agent */
.new-dm{display:flex;align-items:center;gap:.6rem;flex-wrap:wrap;margin-bottom:1rem}
.new-dm select{max-width:260px}

/* Document attachment card in a message */
.msg-file{display:flex;align-items:center;gap:.5rem;margin:.2rem 0;
  border:1px solid var(--line);background:#f8fafc;border-radius:10px;
  padding:.5rem .7rem;text-decoration:none;color:var(--ink);max-width:260px}
.msg-file:hover{border-color:var(--brand);text-decoration:none}
.msg-file .mf-icon{font-size:1.2rem;flex:0 0 auto}
.msg-file .mf-name{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;
  white-space:nowrap;font-weight:600;font-size:.88rem}
.msg-file .mf-dl{flex:0 0 auto;font-size:.75rem;color:var(--brand);font-weight:700}

/* Chat roster (who's online) */
.roster{display:flex;flex-direction:column;gap:.2rem}
.roster-row{display:flex;align-items:center;gap:.6rem;padding:.6rem .3rem;
  border-bottom:1px solid var(--line)}
.roster-row:last-child{border-bottom:none}
.roster-row .pdot{width:11px;height:11px;border-radius:50%;flex:0 0 auto}
.roster-row .pdot.on{background:#22c55e;box-shadow:0 0 0 3px rgba(34,197,94,.2)}
.roster-row .pdot.off{background:#c2ccd8}
.roster-name{font-weight:600}
.roster-state{color:var(--muted);font-size:.85rem;margin-left:auto}
.roster-msg{margin-left:.6rem}
