/* Live-chat support widget + admin support inbox.
   Uses the theme tokens from main.css only, so it follows dark/light. */

/* ---- launcher ---- */
.lcs{position:fixed;right:24px;bottom:24px;z-index:350;font-family:'Figtree',sans-serif;}
.lcs-launch{position:relative;width:52px;height:52px;border-radius:50%;border:none;cursor:pointer;
  background:var(--gold);color:#231905;display:flex;align-items:center;justify-content:center;
  box-shadow:0 14px 30px -14px var(--shadow);transition:transform .16s ease,background .18s;}
html[data-theme="light"] .lcs-launch{color:#fff;}
.lcs-launch:hover{background:var(--gold-2);transform:translateY(-1px);}
.lcs-launch:focus-visible{outline:2px solid var(--cream);outline-offset:3px;}
.lcs-launch svg{width:24px;height:24px;display:block}
.lcs-launch .lcs-ico-chat{transform:translateY(-.5px)}
.lcs-launch .lcs-ico-x{display:none;}
.lcs.open .lcs-launch .lcs-ico-chat{display:none;}
.lcs.open .lcs-launch .lcs-ico-x{display:block;}
.lcs-dot{position:absolute;top:2px;right:2px;width:12px;height:12px;border-radius:50%;
  background:var(--red-txt);border:2px solid var(--bg);}
.lcs-dot[hidden]{display:none;}

/* ---- panel ---- */
.lcs-panel{position:absolute;right:0;bottom:66px;width:360px;max-width:calc(100vw - 32px);
  height:min(540px, calc(100vh - 120px));display:flex;flex-direction:column;
  background:var(--bg-card);border:1px solid var(--line);box-shadow:0 28px 56px -24px var(--shadow);
  animation:lcsin .22s cubic-bezier(.16,.84,.32,1);}
.lcs-panel[hidden]{display:none;}
@keyframes lcsin{from{opacity:0;transform:translateY(8px);}to{opacity:1;transform:none;}}
.lcs-head{display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:14px 16px;border-bottom:1px solid var(--line-soft);flex:none;}
.lcs-title{font-family:'Fraunces',serif;font-size:18px;color:var(--cream);letter-spacing:-.01em;line-height:1.2;}
.lcs-sub{font-family:'Space Mono',monospace;font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:var(--faint);margin-top:2px;}
.lcs-x{background:none;border:none;color:var(--faint);font-size:22px;line-height:1;cursor:pointer;padding:2px 4px;}
.lcs-x:hover{color:var(--cream);}

.lcs-log{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:10px;}

/* ---- messages (shared with the admin thread view) ---- */
.lcs-msg{display:flex;flex-direction:column;max-width:84%;}
.lcs-msg .lcs-bubble{padding:9px 12px;font-size:13.5px;line-height:1.55;color:var(--cream);
  white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;}
.lcs-msg .lcs-meta{font-family:'Space Mono',monospace;font-size:9.5px;letter-spacing:.04em;color:var(--faint);margin-top:4px;}
.lcs-msg.them{align-self:flex-start;}
.lcs-msg.them .lcs-bubble{background:var(--bg-soft);border:1px solid var(--line-soft);}
.lcs-msg.me{align-self:flex-end;align-items:flex-end;}
.lcs-msg.me .lcs-bubble{background:var(--warm-bg);border:1px solid var(--line);}
.lcs-msg.pending{opacity:.6;}

.lcs-note{font-size:12px;color:var(--muted);text-align:center;padding:4px 8px;}
.lcs-note[hidden]{display:none;}

/* ---- composer ---- */
.lcs-form{border-top:1px solid var(--line-soft);padding:12px;flex:none;}
.lcs-ident{display:flex;flex-direction:column;gap:8px;margin-bottom:8px;}
.lcs-ident[hidden]{display:none;}
.lcs-ident .inp{height:36px;line-height:34px;font-size:13px;}
.lcs-ident-hint{font-size:11.5px;color:var(--faint);}
.lcs-hp{position:absolute;left:-10000px;width:1px;height:1px;overflow:hidden;}
.lcs-compose{display:flex;align-items:flex-end;gap:8px;}
.lcs-compose textarea{flex:1;min-width:0;resize:none;background:var(--bg);border:1px solid var(--line);
  color:var(--cream);font-family:'Figtree',sans-serif;font-size:13.5px;line-height:1.45;
  padding:9px 11px;min-height:40px;max-height:120px;border-radius:0;transition:border-color .18s;}
.lcs-compose textarea::placeholder{color:var(--faint);}
.lcs-compose textarea:focus{outline:none;border-color:var(--gold);}
.lcs-send{flex:none;width:40px;height:40px;border:none;cursor:pointer;background:var(--gold);color:#231905;
  display:flex;align-items:center;justify-content:center;transition:background .18s,opacity .18s;}
html[data-theme="light"] .lcs-send{color:#fff;}
.lcs-send:hover:not(:disabled){background:var(--gold-2);}
.lcs-send:disabled{opacity:.45;cursor:not-allowed;}
.lcs-send svg{width:16px;height:16px;}
.lcs-err{font-size:12px;color:var(--red-txt);margin-top:8px;}
.lcs-err[hidden]{display:none;}

/* Pages with the app nav: on narrow screens the tabs move to a fixed bottom bar. */
@media (max-width:820px){
  .lcs.lcs-has-nav{bottom:72px;}
}
@media (max-width:520px){
  .lcs{right:16px;bottom:16px;}
  .lcs.lcs-has-nav{bottom:68px;}
  .lcs-panel{position:fixed;left:16px;right:16px;width:auto;max-width:none;bottom:84px;height:min(520px, calc(100vh - 150px));}
  .lcs.lcs-has-nav .lcs-panel{bottom:136px;height:min(500px, calc(100vh - 200px));}
  /* 16px stops iOS Safari zooming the page when a field gets focus. */
  .lcs-compose textarea,.lcs-ident .inp{font-size:16px;}
}

/* account-menu count (admins: unread support conversations) */
.menu-count{margin-left:auto;min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:var(--gold);color:#231905;
  font-family:'Space Mono',monospace;font-size:10px;font-weight:700;display:inline-flex;align-items:center;justify-content:center;}

/* ---- admin inbox ---- */
.sup-row td{cursor:pointer;}
.sup-row.unread td{background:rgba(204,158,71,.05);}
.sup-row.unread .sup-who{font-weight:600;}
.sup-row.unread td:first-child{box-shadow:inset 3px 0 0 var(--gold);}
.sup-who{color:var(--cream);}
.sup-preview{color:var(--muted);max-width:460px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.sup-time{font-family:'Space Mono',monospace;font-size:11px;color:var(--faint);white-space:nowrap;}
.sup-log{display:flex;flex-direction:column;gap:12px;padding:20px;max-height:62vh;overflow-y:auto;}
.sup-log .lcs-msg{max-width:72%;}
.sup-reply textarea{width:100%;min-height:96px;resize:vertical;background:var(--bg);border:1px solid var(--line);color:var(--cream);
  font-family:'Figtree',sans-serif;font-size:14px;line-height:1.5;padding:11px 13px;border-radius:0;}
.sup-reply textarea:focus{outline:none;border-color:var(--gold);}
@media (max-width:760px){.sup-preview{max-width:none;white-space:normal;}.sup-log .lcs-msg{max-width:90%;}}
