/* SG365 CID popup (v9.8) */
.sg365-pop { border: 0; padding: 0; background: transparent; width: min(520px, calc(100vw - 32px)); max-width: none; overflow: visible; color: #0f172a; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; }
.sg365-pop *, .sg365-pop *::before, .sg365-pop *::after { box-sizing: border-box; }
.sg365-pop::backdrop { background: rgba(15, 23, 42, .55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.sg365-pop[open] { animation: sg365PopIn .26s cubic-bezier(.2, .9, .3, 1.2); }
.sg365-pop.is-closing { animation: sg365PopOut .18s ease-in forwards; }
@keyframes sg365PopIn { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes sg365PopOut { to { opacity: 0; transform: translateY(10px) scale(.97); } }
.sg365-pop-card { position: relative; background: #fff; border-radius: 22px; padding: 26px 24px 22px; box-shadow: 0 30px 80px rgba(15, 23, 42, .35); overflow: hidden; }
.sg365-pop-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: linear-gradient(90deg, #4f46e5, #7c3aed); }
.sg365-pop-success .sg365-pop-card::before { background: linear-gradient(90deg, #059669, #10b981); }
.sg365-pop-error .sg365-pop-card::before { background: linear-gradient(90deg, #dc2626, #f97316); }
.sg365-pop-x { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: #f1f5f9; color: #475569; font-size: 20px; line-height: 1; cursor: pointer; transition: background .15s, transform .15s; }
.sg365-pop-x:hover { background: #e2e8f0; transform: rotate(90deg); }
.sg365-pop-x:focus-visible, .sg365-pop-btn:focus-visible, .sg365-pop-copy:focus-visible { outline: 3px solid #a5b4fc; outline-offset: 2px; }
.sg365-pop-head { display: flex; gap: 14px; align-items: center; padding-right: 36px; }
.sg365-pop-ico { flex: 0 0 52px; width: 52px; height: 52px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 800; color: #fff; background: linear-gradient(135deg, #4f46e5, #7c3aed); box-shadow: 0 10px 24px rgba(79, 70, 229, .35); animation: sg365Pop .5s cubic-bezier(.2, .9, .3, 1.4) .1s both; }
.sg365-pop-success .sg365-pop-ico { background: linear-gradient(135deg, #059669, #10b981); box-shadow: 0 10px 24px rgba(5, 150, 105, .35); }
.sg365-pop-error .sg365-pop-ico { background: linear-gradient(135deg, #dc2626, #f97316); box-shadow: 0 10px 24px rgba(220, 38, 38, .3); }
@keyframes sg365Pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.sg365-pop-titles h3 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.01em; line-height: 1.25; }
.sg365-pop-titles p { margin: 4px 0 0; color: #64748b; font-size: 14px; line-height: 1.5; }
.sg365-pop-body { margin-top: 18px; }
.sg365-pop-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 20px; }
.sg365-pop-btn { appearance: none; border: 1px solid #cbd5e1; background: #fff; color: #0f172a; padding: 10px 18px; border-radius: 12px; font-weight: 700; font-size: 14px; cursor: pointer; text-decoration: none; transition: transform .12s, box-shadow .12s, background .15s; }
.sg365-pop-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(15, 23, 42, .12); }
.sg365-pop-btn.is-primary { background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff; border-color: transparent; box-shadow: 0 8px 20px rgba(79, 70, 229, .3); }
.sg365-pop-success .sg365-pop-btn.is-primary { background: linear-gradient(135deg, #059669, #10b981); box-shadow: 0 8px 20px rgba(5, 150, 105, .3); }
.sg365-pop-error .sg365-pop-btn.is-primary { background: linear-gradient(135deg, #dc2626, #f97316); box-shadow: 0 8px 20px rgba(220, 38, 38, .28); }
/* CID display */
.sg365-pop-cid { position: relative; background: linear-gradient(135deg, #eef2ff, #f5f3ff); border: 1px solid #c7d2fe; border-radius: 18px; padding: 18px; text-align: center; }
.sg365-pop-success .sg365-pop-cid { background: linear-gradient(135deg, #ecfdf5, #f0fdfa); border-color: #a7f3d0; }
.sg365-pop-cid-label { font-size: 11px; text-transform: uppercase; letter-spacing: .14em; font-weight: 800; color: #64748b; }
.sg365-pop-cid-code { display: block; margin: 10px 0 14px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: clamp(14px, 3.6vw, 18px); font-weight: 700; color: #0f172a; word-break: break-all; letter-spacing: .02em; line-height: 1.5; }
.sg365-pop-copy { appearance: none; border: 0; background: #0f172a; color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 700; cursor: pointer; transition: transform .12s, background .15s; }
.sg365-pop-copy:hover { transform: translateY(-1px); background: #1e293b; }
.sg365-pop-copy.is-done { background: #059669; }
.sg365-pop-note { margin: 14px 0 0; color: #475569; font-size: 13px; line-height: 1.55; }
/* token details */
.sg365-pop-facts { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; margin: 14px 0 0; }
.sg365-pop-facts div { background: #f8fafc; border-radius: 12px; padding: 10px 12px; }
.sg365-pop-facts dt { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; font-weight: 800; color: #64748b; }
.sg365-pop-facts dd { margin: 4px 0 0; font-weight: 700; font-size: 14px; color: #0f172a; word-break: break-word; }
.sg365-pop-message { width: 100%; margin-top: 14px; border-radius: 12px; border: 1px solid #e2e8f0; padding: 10px 12px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: #334155; background: #fbfdff; resize: vertical; }
@media (max-width: 520px) { .sg365-pop-facts { grid-template-columns: 1fr; } }
/* error details */
.sg365-pop-ref { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; background: #fff7ed; border: 1px dashed #fdba74; border-radius: 14px; }
.sg365-pop-ref span { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; color: #9a3412; }
.sg365-pop-ref code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 16px; font-weight: 800; letter-spacing: .14em; background: #ffedd5; color: #9a3412; padding: 4px 10px; border-radius: 8px; }
.sg365-pop-msg { margin: 0 0 12px; color: #334155; line-height: 1.6; font-size: 14px; }
.sg365-pop-detail { margin: 0 0 12px; padding: 10px 12px; background: #f8fafc; border-left: 3px solid #f97316; border-radius: 8px; font-size: 12px; color: #475569; white-space: pre-wrap; word-break: break-word; }
.sg365-pop-steps { margin: 14px 0 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 8px; }
.sg365-pop-steps li { counter-increment: s; position: relative; padding: 10px 12px 10px 44px; background: #f8fafc; border-radius: 12px; font-size: 14px; color: #334155; line-height: 1.45; }
.sg365-pop-steps li::before { content: counter(s); position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 50%; background: #0f172a; color: #fff; font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
@media (max-width: 520px) {
    .sg365-pop-card { padding: 22px 16px 18px; border-radius: 18px; }
    .sg365-pop-actions .sg365-pop-btn { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) { .sg365-pop[open], .sg365-pop.is-closing, .sg365-pop-ico { animation: none !important; } }
