
#ff-grok-root{
  position:fixed;z-index:100050;width:0;height:0;
  font-family:"Segoe UI",system-ui,sans-serif;pointer-events:none
}
#ff-grok-root > *{pointer-events:auto}
#ff-grok-fab{
  position:fixed;width:56px;height:56px;border-radius:18px;border:2px solid #1e293b;
  background:linear-gradient(160deg,#e2e8f0 0%,#94a3b8 45%,#64748b 100%);
  box-shadow:0 8px 24px rgba(15,23,42,.28);cursor:grab;display:flex;
  align-items:center;justify-content:center;padding:0;
  touch-action:none;user-select:none;-webkit-user-select:none;
  transition:box-shadow .15s ease,transform .12s ease;z-index:100052
}
#ff-grok-fab:hover{box-shadow:0 12px 28px rgba(15,23,42,.35)}
#ff-grok-fab:focus{outline:2px solid #0ea5e9;outline-offset:3px}
#ff-grok-fab.dragging{cursor:grabbing;transform:scale(1.06);transition:none;z-index:100060}
#ff-grok-fab.hold-ready{box-shadow:0 0 0 3px #0ea5e9,0 12px 28px rgba(15,23,42,.4)}
#ff-grok-fab .ff-grok-face{
  width:32px;height:26px;background:#0f172a;border-radius:8px 8px 10px 10px;
  position:relative;display:block;pointer-events:none
}
#ff-grok-fab .ff-grok-face:before,#ff-grok-fab .ff-grok-face:after{
  content:"";position:absolute;top:7px;width:6px;height:6px;border-radius:50%;
  background:#22d3ee;box-shadow:0 0 6px #22d3ee
}
#ff-grok-fab .ff-grok-face:before{left:6px}
#ff-grok-fab .ff-grok-face:after{right:6px}
#ff-grok-fab .ff-grok-antenna{
  position:absolute;top:5px;left:50%;width:3px;height:9px;margin-left:-1.5px;
  background:#334155;border-radius:2px;pointer-events:none
}
#ff-grok-fab .ff-grok-antenna:after{
  content:"";position:absolute;top:-5px;left:50%;width:7px;height:7px;margin-left:-3.5px;
  border-radius:50%;background:#f59e0b;box-shadow:0 0 8px #f59e0b
}
#ff-grok-panel{
  display:none;position:fixed;z-index:100051;
  flex-direction:column;overflow:hidden;
  background:linear-gradient(180deg,#0f172a 0%,#0b1220 40%,#020617 100%);
  color:#f1f5f9;border:1px solid #475569;
  border-radius:14px;box-shadow:0 22px 56px rgba(2,6,23,.6),0 0 0 1px rgba(14,165,233,.12);
  min-width:300px;min-height:220px;
  --ff-grok-msg-fs:14.5px;--ff-grok-msg-lh:1.55
}
#ff-grok-panel.open{display:flex}
#ff-grok-panel.mode-minimized{
  min-height:0;height:48px !important;max-height:48px;border-radius:12px
}
#ff-grok-panel.mode-minimized #ff-grok-msgs,
#ff-grok-panel.mode-minimized #ff-grok-form,
#ff-grok-panel.mode-minimized .ff-grok-resize,
#ff-grok-panel.mode-minimized #ff-grok-toolbar{display:none !important}
#ff-grok-panel.mode-full{border-radius:10px}
#ff-grok-panel.resizing,#ff-grok-panel.dragging-panel{user-select:none;transition:none}
#ff-grok-head{
  display:flex;align-items:center;gap:10px;padding:10px 12px;
  background:linear-gradient(90deg,#1e293b,#0f172a);border-bottom:1px solid #334155;
  cursor:grab;flex-shrink:0;min-height:48px;box-sizing:border-box;touch-action:none
}
#ff-grok-panel.dragging-panel #ff-grok-head{cursor:grabbing}
#ff-grok-head .mini{
  width:34px;height:34px;border-radius:11px;background:linear-gradient(160deg,#cbd5e1,#64748b);
  display:flex;align-items:center;justify-content:center;flex-shrink:0;pointer-events:none
}
#ff-grok-head .mini span{
  width:17px;height:13px;background:#0f172a;border-radius:3px;position:relative;display:block
}
#ff-grok-head .mini span:before,#ff-grok-head .mini span:after{
  content:"";position:absolute;top:3px;width:3.5px;height:3.5px;border-radius:50%;background:#22d3ee
}
#ff-grok-head .mini span:before{left:3px}#ff-grok-head .mini span:after{right:3px}
#ff-grok-head .titles{min-width:0;flex:1;pointer-events:none}
#ff-grok-head h3{margin:0;font-size:14.5px;font-weight:700;letter-spacing:.01em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#ff-grok-head p{margin:2px 0 0;font-size:11.5px;color:#94a3b8;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#ff-grok-controls{display:flex;align-items:center;gap:2px;flex-shrink:0;margin-left:6px}
#ff-grok-controls button{
  width:30px;height:28px;border:0;border-radius:7px;background:transparent;color:#94a3b8;
  cursor:pointer;font-size:15px;line-height:1;display:inline-flex;align-items:center;justify-content:center
}
#ff-grok-controls button:hover{background:#334155;color:#f8fafc}
#ff-grok-controls button:focus{outline:2px solid #0ea5e9;outline-offset:1px}
#ff-grok-toolbar{
  display:flex;align-items:center;gap:6px;flex-wrap:wrap;padding:6px 10px;
  border-bottom:1px solid #1e293b;background:#0b1220;flex-shrink:0
}
#ff-grok-toolbar .lbl{font-size:10px;color:#64748b;text-transform:uppercase;letter-spacing:.04em;margin-right:2px}
#ff-grok-toolbar button,#ff-grok-toolbar select{
  border:1px solid #334155;background:#1e293b;color:#e2e8f0;border-radius:7px;
  font-size:11.5px;padding:4px 8px;cursor:pointer;height:28px
}
#ff-grok-toolbar button:hover,#ff-grok-toolbar select:hover{border-color:#0ea5e9;color:#fff}
#ff-grok-toolbar button.active{background:#0e7490;border-color:#0891b2;color:#fff}
#ff-grok-msgs{
  flex:1;overflow:auto;padding:14px 16px;display:flex;flex-direction:column;gap:12px;
  background:
    radial-gradient(1200px 400px at 100% 0%, rgba(14,165,233,.08), transparent 55%),
    #0b1220;
  scrollbar-width:thin;scrollbar-color:#475569 transparent
}
#ff-grok-msgs::-webkit-scrollbar{width:8px}
#ff-grok-scrollnav{position:absolute;right:16px;z-index:5;display:flex;flex-direction:column;gap:8px;pointer-events:none}
#ff-grok-scrollnav button{pointer-events:auto;width:40px;height:40px;border-radius:50%;border:1px solid #0891b2;
  background:rgba(8,47,73,.94);color:#e0f2fe;font-size:18px;font-weight:800;line-height:1;cursor:pointer;
  box-shadow:0 4px 14px rgba(0,0,0,.45);display:flex;align-items:center;justify-content:center;transition:opacity .15s}
#ff-grok-scrollnav button:hover{background:#0e7490;color:#fff}
#ff-grok-scrollnav button[hidden]{display:none}
#ff-grok-panel.mode-minimized #ff-grok-scrollnav{display:none}
html[data-ff-theme="light"] #ff-grok-scrollnav button{background:#e0f2fe;color:#0c4a6e;border-color:#0284c7}
@media (max-width:700px){ #ff-grok-scrollnav button{width:44px;height:44px;font-size:20px} }
#ff-grok-msgs::-webkit-scrollbar-thumb{background:#475569;border-radius:8px}
.ff-grok-msg{
  max-width:min(92%,720px);padding:11px 13px;border-radius:12px;
  font-size:var(--ff-grok-msg-fs);line-height:var(--ff-grok-msg-lh);
  white-space:pre-wrap;word-break:break-word;box-shadow:0 1px 0 rgba(255,255,255,.03)
}
.ff-grok-msg.bot{
  align-self:flex-start;background:#1e293b;border:1px solid #475569;color:#f8fafc
}
.ff-grok-msg.user{
  align-self:flex-end;background:linear-gradient(180deg,#0e7490,#0f766e);
  border:1px solid #14b8a6;color:#ecfeff
}
.ff-grok-msg.sys{align-self:center;background:transparent;color:#94a3b8;font-size:12px;padding:2px;box-shadow:none}
.ff-grok-msg.bot .ff-grok-msg-body{white-space:pre-wrap;word-break:break-word}
.ff-grok-msg.bot .ff-grok-msg-body.ff-md{white-space:normal}
.ff-grok-msg.bot.ff-grok-wide{max-width:min(98%,900px)}
.ff-md p{margin:0 0 8px}
.ff-md h3,.ff-md h4{margin:12px 0 6px;font-size:1.05em;font-weight:700;color:#7dd3fc;line-height:1.3}
.ff-md h3:first-child,.ff-md h4:first-child,.ff-md p:first-child{margin-top:0}
.ff-md ul,.ff-md ol{margin:4px 0 8px;padding-left:20px}
.ff-md li{margin:2px 0}
.ff-md hr{border:0;border-top:1px solid #334155;margin:10px 0}
.ff-md code{background:#0f172a;border-radius:4px;padding:1px 4px;font-size:.92em}
.ff-md a{color:#7dd3fc}
.ff-md .ff-md-table{overflow-x:auto;-webkit-overflow-scrolling:touch;margin:6px 0 10px;border:1px solid #334155;border-radius:8px}
.ff-md table{border-collapse:collapse;width:100%;font-size:.93em;line-height:1.4}
.ff-md th{background:#0f172a;color:#cbd5e1;font-weight:700;text-align:left;padding:7px 9px;border-bottom:1px solid #334155;white-space:nowrap}
.ff-md td{padding:6px 9px;border-bottom:1px solid #273449;vertical-align:top}
.ff-md tr:last-child td{border-bottom:0}
.ff-md tbody tr:nth-child(even) td{background:rgba(148,163,184,.06)}
.ff-md td.num,.ff-md th.num{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}
.ff-md td:first-child{white-space:nowrap;font-weight:600}
html[data-ff-theme="light"] .ff-md h3,html[data-ff-theme="light"] .ff-md h4{color:#0369a1 !important}
html[data-ff-theme="light"] .ff-md .ff-md-table{border-color:#cbd5e1 !important}
html[data-ff-theme="light"] .ff-md th{background:#f1f5f9 !important;color:#334155 !important;border-bottom-color:#cbd5e1 !important}
html[data-ff-theme="light"] .ff-md td{border-bottom-color:#e2e8f0 !important}
html[data-ff-theme="light"] .ff-md tbody tr:nth-child(even) td{background:#f8fafc !important}
html[data-ff-theme="light"] .ff-md code{background:#f1f5f9 !important}
html[data-ff-theme="light"] .ff-md hr{border-top-color:#e2e8f0 !important}
html[data-ff-theme="light"] .ff-md a{color:#0369a1 !important}
.ff-grok-vote{
  display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:10px;
  padding-top:8px;border-top:1px solid #334155
}
.ff-grok-vote-hint{font-size:11.5px;color:#94a3b8;flex:1;min-width:120px}
.ff-grok-vote-btn{
  border:1px solid #64748b;background:#0f172a;color:#e2e8f0;border-radius:8px;
  font-size:11.5px;padding:5px 10px;cursor:pointer;white-space:nowrap
}
.ff-grok-vote-btn:hover{border-color:#f87171;color:#fecaca;background:#450a0a}
.ff-grok-vote-btn:disabled{opacity:.55;cursor:default;border-color:#475569;color:#94a3b8;background:#1e293b}
.ff-grok-vote-btn.ff-grok-act:hover{border-color:#38bdf8;color:#e0f2fe;background:#0c4a6e}
.ff-grok-vote-btn.ff-grok-act:disabled:hover{border-color:#475569;color:#94a3b8;background:#1e293b}
.ff-grok-more{border:0;background:none;color:#7dd3fc;font-size:.92em;padding:0;margin-left:4px;cursor:pointer;text-decoration:underline}
.ff-grok-more-body{margin-top:8px;color:#cbd5e1}
.ff-grok-tip-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}
.ff-grok-tip-btn{
  border:1px solid #64748b;background:#0f172a;color:#e2e8f0;border-radius:8px;
  font-size:12px;padding:5px 10px;cursor:pointer
}
.ff-grok-tip-btn.primary{border-color:#22d3ee;background:#0c4a6e;color:#f8fafc}
.ff-grok-tip-list{margin:6px 0 0;padding-left:18px;white-space:normal}
.ff-grok-tip-list li{margin:3px 0}
#ff-grok-form{
  display:flex;gap:8px;padding:10px 12px;border-top:1px solid #334155;
  background:#111827;flex-shrink:0;align-items:flex-end
}
#ff-grok-attach{
  border:1px solid #475569;border-radius:11px;background:#1e293b;color:#e2e8f0;
  font-weight:800;font-size:20px;line-height:1;width:46px;height:46px;cursor:pointer;flex-shrink:0
}
#ff-grok-attach:hover{border-color:#0ea5e9;color:#fff}
#ff-grok-files{display:flex;flex-wrap:wrap;gap:6px;padding:0 12px 8px;background:#111827}
.ff-grok-chip{font-size:11px;background:#1e293b;border:1px solid #334155;color:#cbd5e1;border-radius:999px;padding:3px 8px}
#ff-grok-input{
  flex:1;border:1px solid #475569;border-radius:11px;background:#0f172a;color:#f8fafc;
  padding:11px 12px;font-size:14px;line-height:1.4;resize:none;min-height:46px;max-height:120px;
  font-family:inherit
}
#ff-grok-input:focus{outline:none;border-color:#0ea5e9;box-shadow:0 0 0 3px rgba(14,165,233,.2)}
#ff-grok-send{
  border:0;border-radius:11px;background:linear-gradient(180deg,#38bdf8,#0284c7);color:#fff;
  font-weight:700;padding:0 16px;cursor:pointer;font-size:13.5px;height:46px;min-width:72px
}
#ff-grok-send:hover{filter:brightness(1.06)}
#ff-grok-send:disabled{opacity:.55;cursor:wait;filter:none}
.ff-grok-resize{
  position:absolute;z-index:3;background:transparent;touch-action:none
}
.ff-grok-resize.n{top:0;left:16px;right:16px;height:8px;cursor:ns-resize}
.ff-grok-resize.s{bottom:0;left:16px;right:16px;height:8px;cursor:ns-resize}
.ff-grok-resize.e{right:0;top:16px;bottom:16px;width:8px;cursor:ew-resize}
.ff-grok-resize.w{left:0;top:16px;bottom:16px;width:8px;cursor:ew-resize}
.ff-grok-resize.nw{left:0;top:0;width:16px;height:16px;cursor:nwse-resize}
.ff-grok-resize.ne{right:0;top:0;width:16px;height:16px;cursor:nesw-resize}
.ff-grok-resize.sw{left:0;bottom:0;width:16px;height:16px;cursor:nesw-resize}
.ff-grok-resize.se{
  right:0;bottom:0;width:20px;height:20px;cursor:nwse-resize;
  background:linear-gradient(135deg,transparent 46%,#64748b 46%,#94a3b8 58%,transparent 58%)
}
#ff-grok-panel.mode-full .ff-grok-resize,
#ff-grok-panel.mode-minimized .ff-grok-resize{display:none}
@media (max-width:640px){
  #ff-grok-toolbar .lbl{display:none}
  .ff-grok-msg{max-width:96%}
}

/* ── Light theme (Profile → Appearance → Light) ──
   Light surfaces + dark text; !important beats platform button remaps. */
html[data-ff-theme="light"] #ff-grok-fab{
  border-color:#93c5fd !important;
  background:linear-gradient(160deg,#ffffff 0%,#e2e8f0 50%,#cbd5e1 100%) !important;
  box-shadow:0 8px 24px rgba(15,23,42,.14) !important
}
html[data-ff-theme="light"] #ff-grok-fab:hover{box-shadow:0 12px 28px rgba(15,23,42,.2) !important}
html[data-ff-theme="light"] #ff-grok-fab .ff-grok-face{background:#0c4a6e !important}
html[data-ff-theme="light"] #ff-grok-fab .ff-grok-antenna{background:#64748b !important}
html[data-ff-theme="light"] #ff-grok-panel{
  background:linear-gradient(180deg,#ffffff 0%,#f8fafc 55%,#f1f5f9 100%) !important;
  color:#0f172a !important;
  border-color:#93c5fd !important;
  box-shadow:0 22px 56px rgba(15,23,42,.16),0 0 0 1px rgba(14,165,233,.18) !important
}
html[data-ff-theme="light"] #ff-grok-head{
  background:linear-gradient(90deg,#eff6ff,#f8fafc) !important;
  border-bottom-color:#bfdbfe !important;
  color:#0f172a !important
}
html[data-ff-theme="light"] #ff-grok-head .mini{
  background:linear-gradient(160deg,#e0f2fe,#7dd3fc) !important;
  border:1px solid #38bdf8 !important
}
html[data-ff-theme="light"] #ff-grok-head .mini span{background:#0c4a6e !important}
html[data-ff-theme="light"] #ff-grok-head h3{color:#0f172a !important}
html[data-ff-theme="light"] #ff-grok-head p{color:#475569 !important}
html[data-ff-theme="light"] #ff-grok-controls button{
  background:transparent !important;color:#64748b !important;border:0 !important
}
html[data-ff-theme="light"] #ff-grok-controls button:hover{
  background:#dbeafe !important;color:#0f172a !important
}
html[data-ff-theme="light"] #ff-grok-toolbar{
  border-bottom-color:#e2e8f0 !important;background:#f8fafc !important
}
html[data-ff-theme="light"] #ff-grok-toolbar .lbl{color:#64748b !important}
html[data-ff-theme="light"] #ff-grok-toolbar button,
html[data-ff-theme="light"] #ff-grok-toolbar select{
  border:1px solid #cbd5e1 !important;background:#ffffff !important;color:#0f172a !important
}
html[data-ff-theme="light"] #ff-grok-toolbar button:hover,
html[data-ff-theme="light"] #ff-grok-toolbar select:hover{
  border-color:#0284c7 !important;color:#0c4a6e !important
}
html[data-ff-theme="light"] #ff-grok-toolbar button.active{
  background:#0284c7 !important;border-color:#0369a1 !important;color:#ffffff !important
}
html[data-ff-theme="light"] #ff-grok-msgs{
  background:
    radial-gradient(1200px 400px at 100% 0%, rgba(14,165,233,.1), transparent 55%),
    #f1f5f9 !important;
  color:#0f172a !important;
  scrollbar-color:#94a3b8 transparent
}
html[data-ff-theme="light"] #ff-grok-msgs::-webkit-scrollbar-thumb{background:#94a3b8 !important}
html[data-ff-theme="light"] .ff-grok-msg{
  box-shadow:0 1px 2px rgba(15,23,42,.06) !important
}
html[data-ff-theme="light"] .ff-grok-msg.bot{
  background:#ffffff !important;border-color:#cbd5e1 !important;color:#0f172a !important
}
html[data-ff-theme="light"] .ff-grok-msg.user{
  background:linear-gradient(180deg,#0284c7,#0e7490) !important;
  border-color:#0369a1 !important;color:#ffffff !important
}
html[data-ff-theme="light"] .ff-grok-msg.sys{color:#64748b !important}
html[data-ff-theme="light"] .ff-grok-vote{border-top-color:#e2e8f0 !important}
html[data-ff-theme="light"] .ff-grok-vote-hint{color:#64748b !important}
html[data-ff-theme="light"] .ff-grok-vote-btn{
  border:1px solid #94a3b8 !important;background:#ffffff !important;color:#0f172a !important
}
html[data-ff-theme="light"] .ff-grok-vote-btn:hover{
  border-color:#dc2626 !important;color:#7f1d1d !important;background:#fee2e2 !important
}
html[data-ff-theme="light"] .ff-grok-vote-btn:disabled{
  border-color:#cbd5e1 !important;color:#64748b !important;background:#f1f5f9 !important
}
html[data-ff-theme="light"] .ff-grok-vote-btn.ff-grok-act:hover{
  border-color:#0284c7 !important;color:#0c4a6e !important;background:#e0f2fe !important
}
html[data-ff-theme="light"] .ff-grok-more{color:#0369a1 !important}
html[data-ff-theme="light"] .ff-grok-more-body{color:#374151 !important}
html[data-ff-theme="light"] .ff-grok-tip-btn{
  border:1px solid #94a3b8 !important;background:#ffffff !important;color:#0f172a !important
}
html[data-ff-theme="light"] .ff-grok-tip-btn.primary{
  border-color:#0369a1 !important;background:#dbeafe !important;color:#1e3a8a !important
}
html[data-ff-theme="light"] #ff-grok-form{
  border-top-color:#e2e8f0 !important;background:#f8fafc !important;color:#0f172a !important
}
html[data-ff-theme="light"] #ff-grok-attach{
  border:1px solid #94a3b8 !important;background:#ffffff !important;color:#0f172a !important
}
html[data-ff-theme="light"] #ff-grok-attach:hover{
  border-color:#0284c7 !important;color:#0369a1 !important;background:#eff6ff !important
}
html[data-ff-theme="light"] #ff-grok-files{background:#f8fafc !important}
html[data-ff-theme="light"] .ff-grok-chip{
  background:#ffffff !important;border-color:#cbd5e1 !important;color:#334155 !important
}
html[data-ff-theme="light"] #ff-grok-input{
  border:1px solid #94a3b8 !important;background:#ffffff !important;color:#0f172a !important
}
html[data-ff-theme="light"] #ff-grok-input::placeholder{color:#94a3b8 !important}
html[data-ff-theme="light"] #ff-grok-input:focus{
  border-color:#0284c7 !important;box-shadow:0 0 0 3px rgba(2,132,199,.2) !important
}
html[data-ff-theme="light"] #ff-grok-send{
  background:linear-gradient(180deg,#38bdf8,#0284c7) !important;
  color:#ffffff !important;border:0 !important
}
html[data-ff-theme="light"] #ff-grok-send:hover{filter:brightness(1.06)}
html[data-ff-theme="light"] .ff-grok-resize.se{
  background:linear-gradient(135deg,transparent 46%,#94a3b8 46%,#64748b 58%,transparent 58%) !important
}
