#jdchat-widget, .jdchat-admin { --jd-ink:#402542; --jd-purple:#9a3a71; --jd-soft:#fff4f7; --jd-border:#e6d5df; font-family:inherit; color:var(--jd-ink); }
#jdchat-widget *, .jdchat-admin * { box-sizing:border-box; }
#jdchat-widget [hidden] { display:none !important; }
#jdchat-widget { position:fixed; right:22px; bottom:22px; z-index:99990; font-size:15px; line-height:1.5; display:flex; flex-direction:column; align-items:flex-end; }
#jdchat-widget button { cursor:pointer; font:inherit; border:0; border-radius:10px; padding:11px 16px; background:var(--jd-purple); color:#fff; margin:0; }
#jdchat-widget button:disabled { opacity:.55; cursor:wait; }
#jdchat-widget button:focus-visible, #jdchat-widget input:focus-visible, #jdchat-widget textarea:focus-visible { outline:3px solid #d8b5ff; outline-offset:3px; }
#jdchat-widget #jdchat-launch { width:76px; height:76px; min-width:76px; min-height:76px; padding:0; border:3px solid #fff; border-radius:50%; display:grid; place-items:center; box-shadow:0 12px 30px #40254255, 0 4px 10px #40254235; order:2; }
#jdchat-launch .jdchat-launch-icon { font-family:"fontawesome"; font-weight:900; font-style:normal; font-size:32px; line-height:1; }
#jdchat-launch .jdchat-launch-icon::before { content:"\f086"; }
#jdchat-panel { position:relative; width:400px; max-width:calc(100vw - 32px); height:min(640px, calc(100dvh - 130px)); background:#fff; border:1px solid var(--jd-border); border-radius:18px; box-shadow:0 16px 60px #24213530; display:flex; flex-direction:column; overflow:hidden; margin-bottom:14px; order:1; }
#jdchat-panel header { display:flex; flex-shrink:0; justify-content:space-between; align-items:center; padding:11px 14px; background:var(--jd-soft); gap:10px; }
#jdchat-panel header strong { font-size:18px; line-height:1.3; }
#jdchat-panel header p { font-size:11px; line-height:1.35; margin:2px 0 0; }
.jdchat-header-actions { display:flex; gap:2px; align-items:center; }
#jdchat-panel #jdchat-hide, #jdchat-panel #jdchat-menu-toggle { width:32px; height:36px; background:transparent; color:var(--jd-ink); font-size:25px; padding:0; display:grid; place-items:center; }
#jdchat-panel .jdchat-menu-icon, #jdchat-panel .jdchat-send-icon { font-family:"fontawesome"; font-weight:900; font-style:normal; font-size:20px; line-height:1; }
.jdchat-menu-icon::before { content:"\f142"; }
.jdchat-send-icon::before { content:"\f1d8"; }
#jdchat-menu { position:absolute; z-index:3; top:56px; right:10px; min-width:210px; padding:6px; border:1px solid var(--jd-border); background:#fff; border-radius:12px; box-shadow:0 8px 24px #40254230; }
#jdchat-menu button, #jdchat-menu a { display:block; width:100%; padding:10px 12px; background:transparent; color:var(--jd-ink); text-align:left; font:inherit; font-size:13px; text-decoration:none; border-radius:6px; text-transform:none; }
#jdchat-menu button:hover, #jdchat-menu a:hover { background:var(--jd-soft); }
#jdchat-entry { flex:1; min-height:0; margin:0; overflow-y:auto; padding:24px 20px; display:flex; flex-direction:column; gap:18px; background:#fff; }
#jdchat-entry h2 { font-size:21px; line-height:1.3; margin:0 0 8px; }
#jdchat-entry p { font-size:14px; line-height:1.5; margin:0; color:#735d71; }
#jdchat-profile { display:grid; gap:6px; }
#jdchat-profile label { font-size:13px; }
#jdchat-profile input { width:100%; height:48px; min-height:48px; margin:0; padding:11px; border:1px solid var(--jd-border); border-radius:10px; background:#fff; color:var(--jd-ink); font:inherit; font-size:16px; }
#jdchat-entry #jdchat-start { width:100%; font-size:15px; text-transform:none; }
#jdchat-messages { flex:1; min-height:0; overflow-y:auto; overscroll-behavior:contain; padding:16px; background:#fffaf8; display:flex; flex-direction:column; align-items:flex-start; gap:12px; }
.jdchat-bubble { background:#fffaf3; border-radius:12px; padding:10px 12px; margin:0 0 12px; overflow-wrap:anywhere; }
.jdchat-bubble strong { font-size:12px; }
.jdchat-bubble p { margin:4px 0 0; white-space:pre-wrap; }
.jdchat-bubble.jdchat-mine { background:#f6cee0; margin-left:25px; }
#jdchat-messages .jdchat-bubble { flex-shrink:0; max-width:88%; width:fit-content; margin:0; background:#fff; border:1px solid #eee2e7; box-shadow:0 2px 4px #40254208; }
#jdchat-messages .jdchat-mine { align-self:flex-end; margin:0; background:#f6cee0; border-color:#e9bad1; }
#jdchat-messages .jdchat-bubble p { font-size:15px; line-height:1.5; }
#jdchat-messages .jdchat-meta { display:block; margin-top:5px; font-size:11px; line-height:1.4; text-align:right; color:#735d71; }
#jdchat-form { flex-shrink:0; padding:10px 14px; margin:0; border-top:1px solid var(--jd-border); background:#fff; }
#jdchat-form .jdchat-compose-row { display:flex; gap:8px; align-items:flex-end; }
#jdchat-form input:not([type="checkbox"]), #jdchat-form textarea { margin:0; padding:11px; color:var(--jd-ink); background:#fff; border:1px solid var(--jd-border); border-radius:12px; font:inherit; font-size:16px; line-height:24px; min-height:48px; height:48px; max-height:120px; box-shadow:none; }
#jdchat-form input:not([type="checkbox"]) { width:100%; }
#jdchat-consent { display:flex; gap:8px; align-items:flex-start; margin:0; font-size:13px; line-height:1.5; cursor:pointer; }
#jdchat-consent input { position:static; display:block; opacity:1; appearance:auto; flex-shrink:0; width:18px; height:18px; min-height:18px; margin:1px 0 0; padding:0; accent-color:var(--jd-purple); }
#jdchat-consent a { color:var(--jd-purple); text-decoration:underline; }
#jdchat-form textarea { flex:1; min-width:0; width:100%; resize:none; overflow-y:auto; transition:none; }
#jdchat-form #jdchat-submit { flex-shrink:0; width:46px; height:46px; min-width:46px; padding:0; border-radius:50%; display:grid; place-items:center; font-size:14px; text-transform:none; }
#jdchat-form.jdchat-closed textarea, #jdchat-form.jdchat-closed details { display:none; }
#jdchat-form.jdchat-closed #jdchat-submit { width:100%; border-radius:10px; padding:10px; }
#jdchat-error { font-size:12px; margin:0; padding:0 16px 8px; color:#8c2231; }
#jdchat-error:empty { display:none; }
#jdchat-activity { flex-shrink:0; font-size:12px; margin:0; padding:8px 16px; background:#fff; color:#735d71; }
#jdchat-widget #jdchat-new { flex-shrink:0; border-radius:0; padding:7px 12px; font-size:12px; background:#eee4f6; color:var(--jd-ink); text-transform:none; }
#jdchat-widget #jdchat-resume { position:absolute; right:88px; bottom:17px; white-space:nowrap; padding:9px 13px; border-radius:30px; background:#fff; color:var(--jd-ink); border:1px solid var(--jd-border); font-size:13px; text-transform:none; box-shadow:0 4px 18px #40254222; }
#jdchat-widget.jdchat-open #jdchat-resume { display:none; }
.jdchat-sr-only { position:absolute !important; width:1px !important; height:1px !important; padding:0 !important; margin:-1px !important; overflow:hidden !important; clip:rect(0,0,0,0) !important; white-space:nowrap !important; border:0 !important; }
.jdchat-empty { font-size:14px; color:#666; }
#jdchat-widget.jdchat-inline { position:relative; right:auto; bottom:auto; }
.jdchat-toolbar, .jdchat-actions { display:flex; align-items:center; flex-wrap:wrap; gap:8px; margin:12px 0; }
.jdchat-layout { display:grid; grid-template-columns:270px minmax(0,1fr); gap:20px; align-items:start; max-width:1250px; }
.jdchat-layout nav, #jdchat-detail { background:#fff; padding:18px; border:1px solid var(--jd-border); border-radius:12px; }
.jdchat-list-item { display:block; width:100%; padding:13px; margin-bottom:8px; text-align:left; border:1px solid var(--jd-border); background:#fff; border-radius:8px; white-space:pre-line; cursor:pointer; }
.jdchat-list-item.selected { border-color:var(--jd-purple); background:var(--jd-soft); }
.jdchat-history { max-height:400px; overflow:auto; margin-top:15px; }
.jdchat-internal { background:#fff8df; border-left:3px solid #ce9a21; }
.jdchat-alert, #jdchat-admin-error { color:#982038; font-weight:600; }
#jdchat-compose { display:block; width:100%; margin-top:8px; }
.jdchat-notice, .jdchat-draft { border:1px solid var(--jd-border); padding:12px; border-radius:8px; margin:10px 0; }
.jdchat-notice pre { white-space:pre-wrap; overflow-wrap:anywhere; font:inherit; }
.jdchat-notice button { margin:3px !important; }
.jdchat-muted { color:#777; font-size:11px; }
@media(max-width:782px) {
  .jdchat-layout { grid-template-columns:1fr; }
  #jdchat-widget { right:16px; bottom:calc(16px + env(safe-area-inset-bottom)); }
  body.jdchat-chat-open { overflow:hidden; }
  #jdchat-widget.jdchat-open { inset:auto; left:0; top:var(--jdchat-viewport-top, 0px); width:100%; height:var(--jdchat-viewport-height, 100dvh); z-index:2147483000; }
  #jdchat-widget.jdchat-open #jdchat-launch { display:none; }
  #jdchat-panel { width:100%; max-width:none; height:100%; max-height:none; margin:0; border:0; border-radius:0; }
  #jdchat-panel header { padding-top:calc(11px + env(safe-area-inset-top)); }
  #jdchat-form { padding-bottom:calc(10px + env(safe-area-inset-bottom)); }
  #jdchat-form textarea { max-height:96px; }
}

/* Opciones y enlaces del historial, sin estilos globales del tema. */
#jdchat-menu { max-width:calc(100% - 20px); max-height:calc(100% - 74px); overflow-y:auto; }
#jdchat-menu .jdchat-preference { display:grid; grid-template-columns:minmax(0,1fr) 20px; align-items:center; gap:3px 12px; padding:10px 12px; font-size:13px; cursor:pointer; }
#jdchat-menu .jdchat-preference small { grid-column:1 / -1; font-size:11px; color:#735d71; }
#jdchat-menu .jdchat-preference input { position:static; opacity:1; appearance:auto; width:18px; height:18px; margin:0; padding:0; accent-color:var(--jd-purple); }
#jdchat-menu hr { border:0; border-top:1px solid var(--jd-border); margin:5px 8px; }
#jdchat-menu #jdchat-end { color:#8c2231; }
#jdchat-messages .jdchat-message-link { display:inline-block; max-width:100%; padding:5px 8px; margin:4px 0; border:1px solid #d9bfd0; border-radius:7px; color:#7e285b; background:#fff4f7; font-weight:600; text-decoration:underline; text-underline-offset:2px; overflow-wrap:anywhere; white-space:normal; }
#jdchat-messages .jdchat-message-link:hover { background:#f6e5ef; }
#jdchat-widget a:focus-visible { outline:3px solid #d8b5ff; outline-offset:3px; }
