/* Club Fortuna · soporte web propio. El widget comparte tokens visuales con el landing. */
#cf-widget-root {
  --cf-void: #050a12;
  --cf-panel: #0c1727;
  --cf-panel-alt: #13243a;
  --cf-line: rgba(218, 185, 105, .18);
  --cf-line-strong: rgba(218, 185, 105, .38);
  --cf-gold: #d8ae4d;
  --cf-gold-bright: #f6d98a;
  --cf-ink: #f5f1e8;
  --cf-ink-soft: #afbac8;
  --cf-ink-faint: #718095;
  --cf-radius-sm: 10px;
  --cf-radius-md: 14px;
  --cf-type-h3: clamp(1.45rem, 5vw, 1.75rem);
  --cf-type-body: .78rem;
  --cf-type-small: .64rem;
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 9999;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
#cf-widget-root *, #cf-widget-root *::before, #cf-widget-root *::after { box-sizing: border-box; }
#cf-widget-root button, #cf-widget-root input, #cf-widget-root textarea { font: inherit; }
#cf-widget-root button:focus-visible, #cf-widget-root input:focus-visible, #cf-widget-root textarea:focus-visible { outline: 3px solid rgba(246, 217, 138, .7); outline-offset: 2px; }
.cf-bubble {
  position: relative;
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--cf-line-strong);
  border-radius: 50%;
  color: var(--cf-ink);
  background: linear-gradient(145deg, #1c3658, #0d1b2d);
  box-shadow: 0 16px 36px rgba(0, 0, 0, .46), 0 0 0 5px rgba(216, 174, 77, .07);
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.cf-bubble:hover { transform: translateY(-3px); border-color: var(--cf-gold-bright); box-shadow: 0 20px 40px rgba(0, 0, 0, .5), 0 0 0 5px rgba(216, 174, 77, .11); }
.cf-bubble img { width: 100%; height: 100%; padding: 5px; object-fit: contain; border-radius: 50%; clip-path: circle(50% at 50% 50%); }
.cf-bubble::after { display: none; }
.cf-bubble-dot { display: none; }

.cf-panel {
  position: absolute;
  right: 0;
  bottom: 78px;
  display: flex;
  flex-direction: column;
  width: min(390px, calc(100vw - 32px));
  height: min(560px, calc(100dvh - 110px));
  overflow: hidden;
  border: 1px solid var(--cf-line-strong);
  border-radius: 23px;
  background: var(--cf-panel);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .58), 0 0 0 5px rgba(216, 174, 77, .05);
  animation: cf-panel-in .18s ease both;
}
.cf-panel.hidden { display: none; }
@keyframes cf-panel-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.cf-panel-header { display: flex; align-items: center; gap: 11px; min-height: 76px; padding: 13px 15px; border-bottom: 1px solid var(--cf-line); background: linear-gradient(135deg, #10223a, #172e4b); }
.cf-panel-header-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cf-header-logo { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px; overflow: hidden; border: 1px solid var(--cf-line-strong); border-radius: 50%; background: rgba(3, 8, 15, .42); }
.cf-header-logo img { width: 38px; height: 38px; object-fit: contain; border-radius: 50%; clip-path: circle(50% at 50% 50%); }
.cf-panel-title { margin: 0; color: var(--cf-ink); font-size: var(--cf-type-body); font-weight: 800; }
.cf-panel-status { display: flex; align-items: center; margin: 4px 0 0; color: var(--cf-ink-faint); font-size: var(--cf-type-small); letter-spacing: .08em; text-transform: uppercase; }
.cf-close-btn { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 36px; margin-left: auto; padding: 0; border: 1px solid transparent; border-radius: var(--cf-radius-sm, 10px); color: var(--cf-ink-soft); background: transparent; cursor: pointer; }
.cf-close-btn:hover { color: var(--cf-ink); border-color: var(--cf-line); background: rgba(255, 255, 255, .07); }
.cf-panel-body { display: flex; flex: 1; flex-direction: column; min-height: 0; overflow-y: auto; padding: 20px 16px 16px; background: radial-gradient(340px 260px at 50% 0%, rgba(216, 174, 77, .08), transparent 74%), var(--cf-panel); }

.cf-welcome { display: flex; flex: 1; flex-direction: column; align-items: stretch; justify-content: center; min-height: 100%; text-align: center; }
.cf-welcome-emblem { display: grid; place-items: center; width: 66px; height: 66px; margin: 0 auto 17px; overflow: hidden; border: 1px solid var(--cf-line-strong); border-radius: 50%; background: linear-gradient(145deg, rgba(216, 174, 77, .17), rgba(17, 36, 59, .86)); box-shadow: 0 12px 25px rgba(0, 0, 0, .2); }
.cf-welcome-emblem img { width: 53px; height: 53px; object-fit: contain; border-radius: 50%; clip-path: circle(50% at 50% 50%); }
.cf-welcome h3 { margin: 0 0 8px; color: var(--cf-ink); font-family: Fraunces, Georgia, serif; font-size: var(--cf-type-h3); font-weight: 600; letter-spacing: -.035em; }
.cf-welcome p { margin: 0 auto; max-width: 285px; color: var(--cf-ink-soft); font-size: var(--cf-type-body); line-height: 1.65; }
.cf-welcome-actions { display: grid; gap: 9px; margin-top: 25px; }
.cf-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 14px; border: 1px solid transparent; border-radius: 12px; font-size: var(--cf-type-small); font-weight: 800; transition: transform .18s ease, background .18s ease, border-color .18s ease, filter .18s ease; cursor: pointer; }
.cf-btn:hover { transform: translateY(-2px); }
.cf-btn:disabled { cursor: wait; opacity: .56; transform: none; }
.cf-btn-gold { color: #171108; background: linear-gradient(135deg, var(--cf-gold-bright), var(--cf-gold)); border-color: rgba(255, 225, 144, .58); box-shadow: 0 9px 21px rgba(216, 174, 77, .15); }
.cf-btn-gold:hover { filter: brightness(1.06); }
.cf-btn-outline { color: var(--cf-gold-bright); background: transparent; border-color: var(--cf-line-strong); }
.cf-btn-outline:hover { background: rgba(216, 174, 77, .11); }
.cf-btn-link { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; padding: 5px 0; border: 0; color: var(--cf-ink-faint); background: transparent; font-size: var(--cf-type-small); text-decoration: underline; cursor: pointer; }
.cf-btn-link:hover { color: var(--cf-ink); }
.cf-private-note { margin-top: 24px !important; color: var(--cf-ink-faint) !important; font-size: 10px !important; }
.cf-security-note { margin: 0; color: var(--cf-ink-faint); font-size: var(--cf-type-small); line-height: 1.6; }
.cf-notification-prompt { display: grid; gap: 8px; margin-top: 18px; padding: 12px; border: 1px solid var(--cf-line); border-radius: 13px; color: var(--cf-ink-soft); background: rgba(216, 174, 77, .06); text-align: left; }
.cf-notification-prompt strong { color: var(--cf-gold-bright); font-size: 11px; }
.cf-notification-prompt span { font-size: 10px; line-height: 1.5; }
.cf-notification-prompt div { display: flex; align-items: center; gap: 12px; }
.cf-notification-prompt .cf-btn { min-height: 34px; }
.cf-notification-prompt .cf-btn-link { font-size: 10px; }

.cf-user-card { margin-bottom: 16px; padding: 15px; border: 1px solid var(--cf-line); border-radius: 14px; background: rgba(19, 36, 58, .78); text-align: left; }
.cf-user-card p { margin: 0 0 3px; color: var(--cf-ink-faint); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.cf-user-card strong { display: block; overflow-wrap: anywhere; color: var(--cf-ink); font-size: var(--cf-type-body); }
.cf-back-link { margin-bottom: 15px; }

.cf-chat { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.cf-chat-messages { display: flex; flex: 1; flex-direction: column; gap: 9px; min-height: 0; overflow-y: auto; padding: 2px 2px 13px; }
.cf-msg { max-width: 86%; padding: 10px 12px; border-radius: 14px; color: var(--cf-ink); font-size: var(--cf-type-body); line-height: 1.5; overflow-wrap: anywhere; }
.cf-msg-system { align-self: center; max-width: 100%; padding: 8px; color: var(--cf-ink-faint); background: transparent; font-size: 10px; text-align: center; }
.cf-msg-agent { align-self: flex-start; border: 1px solid var(--cf-line); border-top-left-radius: 5px; background: var(--cf-panel-alt); }
.cf-msg-user { align-self: flex-end; border: 1px solid rgba(216, 174, 77, .4); border-top-right-radius: 5px; background: rgba(216, 174, 77, .15); }
.cf-day-divider { align-self: center; margin: 8px 0 1px; color: var(--cf-ink-faint); font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.cf-older { align-self: center; margin-bottom: 8px; }
.cf-agent-typing { display: flex; align-items: center; gap: 4px; align-self: flex-start; padding: 9px 12px; border: 1px solid var(--cf-line); border-radius: 12px; background: var(--cf-panel-alt); }
.cf-agent-typing span { width: 5px; height: 5px; border-radius: 50%; background: var(--cf-ink-faint); animation: cf-blink 1.1s infinite ease-in-out; }
.cf-agent-typing span:nth-child(2) { animation-delay: .15s; }
.cf-agent-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes cf-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.cf-chat-input-row { display: flex; align-items: end; gap: 7px; padding-top: 12px; border-top: 1px solid var(--cf-line); }
.cf-chat-input-row textarea { flex: 1; min-width: 0; min-height: 42px; max-height: 112px; resize: vertical; padding: 11px 12px; border: 1px solid var(--cf-line); border-radius: 13px; color: var(--cf-ink); background: var(--cf-panel-alt); font-size: 12px; line-height: 1.4; }
.cf-chat-input-row textarea::placeholder { color: var(--cf-ink-faint); }
.cf-chat-input-row textarea:focus { border-color: var(--cf-gold); }
.cf-chat-input-row > button { display: grid; place-items: center; width: 40px; min-width: 40px; height: 42px; padding: 0; border: 1px solid var(--cf-line); border-radius: 12px; color: var(--cf-gold-bright); background: rgba(216, 174, 77, .08); cursor: pointer; }
.cf-chat-input-row > button:hover { border-color: var(--cf-line-strong); background: rgba(216, 174, 77, .16); }
.cf-chat-input-row > button[type="submit"] { color: #171108; border-color: rgba(255, 225, 144, .5); background: linear-gradient(135deg, var(--cf-gold-bright), var(--cf-gold)); }
.cf-chat-input-row > button:disabled { cursor: wait; opacity: .55; }
.cf-inline-form { display: flex; flex-direction: column; gap: 8px; margin-top: 7px; text-align: left; }
.cf-inline-form label { color: var(--cf-ink-soft); font-size: 10px; font-weight: 700; }
.cf-inline-form input { width: 100%; padding: 11px 12px; border: 1px solid var(--cf-line); border-radius: 11px; color: var(--cf-ink); background: var(--cf-panel-alt); font-size: 12px; }
.cf-inline-form input:focus { border-color: var(--cf-gold); }
.cf-inline-form .cf-btn { width: 100%; margin-top: 8px; }
.cf-form-error { margin: 0 !important; color: #ff9baa !important; font-size: 10px !important; }
.cf-image-link { display: block; max-width: 100%; }
.cf-chat-image { display: block; max-width: 100%; border: 1px solid var(--cf-line); border-radius: var(--cf-radius-sm); object-fit: contain; }
.cf-pdf-link { display: inline-flex; align-items: center; gap: 6px; color: var(--cf-gold-bright); font-weight: 700; text-decoration: underline; }
.cf-icon { display: block; width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.cf-icon-sm { width: 16px; height: 16px; }

.cf-image-viewer { position: fixed; inset: 0; z-index: 10001; display: grid; place-items: center; padding: 18px; background: rgba(1, 4, 9, .86); backdrop-filter: blur(10px); }
.cf-image-viewer[hidden] { display: none; }
.cf-image-viewer-card { position: relative; display: flex; flex-direction: column; width: min(100%, 900px); max-height: calc(100dvh - 36px); padding: 16px; border: 1px solid var(--cf-line-strong); border-radius: 20px; background: var(--cf-panel); box-shadow: 0 30px 90px rgba(0, 0, 0, .58); }
.cf-image-viewer-close { position: absolute; top: 10px; right: 10px; z-index: 1; display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--cf-line); border-radius: 11px; color: var(--cf-ink); background: rgba(5, 10, 18, .75); }
.cf-image-viewer-stage { display: grid; place-items: center; min-height: 180px; overflow: auto; padding: 34px 8px 13px; border-radius: 13px; background: #03070d; }
.cf-image-viewer-stage img { max-width: 100%; max-height: calc(100dvh - 170px); object-fit: contain; transform-origin: center; transition: transform .15s ease; }
.cf-image-viewer-controls { display: flex; justify-content: center; gap: 8px; padding-top: 12px; }
.cf-image-viewer-controls button { min-width: 42px; min-height: 35px; border: 1px solid var(--cf-line); border-radius: 9px; color: var(--cf-gold-bright); background: var(--cf-panel-alt); font-size: 12px; }
.cf-image-viewer-controls button:hover { border-color: var(--cf-line-strong); }

@media (max-width: 520px) {
  #cf-widget-root { right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); }
  .cf-bubble { width: 56px; height: 56px; border-radius: 50%; }
  .cf-bubble img { width: 100%; height: 100%; padding: 4px; }
  .cf-panel { right: 0; bottom: 70px; width: calc(100vw - 24px); height: min(68dvh, 540px); border-radius: 20px; }
  .cf-panel-header { min-height: 68px; }
  .cf-panel-body { padding: 16px 13px 13px; }
  .cf-welcome h3 { font-size: 25px; }
  .cf-msg { max-width: 90%; }
}
