/* ===== Dữ liệu điểm: menu, xây dựng, xem dữ liệu ===== */
.pd { --pd-accent: #2563eb; --pd-accent-soft: #e8efff; --pd-warm: #d97706; --pd-warm-soft: #fff4e0; --pd-ink: #0f1b33; --pd-radius: 18px; }
.pd svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Marker có dữ liệu */
.pl-marker.has-data .pl-dot { background: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, .35), 0 0 0 7px rgba(37, 99, 235, .12); }
.pl-marker.has-data .pl-tag { border-color: rgba(37, 99, 235, .6); }
.pd-badge { position: absolute; left: -15px; top: -17px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 999px; background: #d97706; color: #fff; font: 800 10px/15px "Nunito", system-ui, sans-serif; text-align: center; border: 1.5px solid #fff; box-shadow: 0 1px 3px rgba(15, 27, 51, .3); pointer-events: none; }
.pl-data { width: 24px; height: 24px; border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; border-radius: 6px; padding: 0; flex: none; }
.pl-data svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pl-data:hover { color: var(--teal); background: rgba(37, 99, 235, .1); }
.pl-list li.has-data .pl-data { color: var(--teal); }
.pl-list li.has-data .pl-go i { background: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, .3); }

/* Hộp thoại chung */
dialog.pd { border: 0; padding: 0; color: var(--text); font-family: "Nunito", ui-sans-serif, system-ui, sans-serif; background: transparent; overflow: visible; }
dialog.pd::backdrop { background: rgba(15, 25, 45, .5); backdrop-filter: blur(4px); }
dialog.pd[open] .pd-card { animation: pd-in .22s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes pd-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { dialog.pd[open] .pd-card, .pd-menu-card { animation: none !important; } }

.pd-x { width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; flex: none; }
.pd-x:hover { background: var(--panel2); color: var(--text); }
.pd .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.pd .btn svg { width: 16px; height: 16px; }
.pd :focus-visible { outline: 2.5px solid var(--pd-accent); outline-offset: 2px; }

/* ----- Menu 2 nút ----- */
dialog.pd-menu { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; }
dialog.pd-menu::backdrop { background: rgba(15, 25, 45, .12); backdrop-filter: none; }
.pd-menu-card { position: absolute; width: 300px; background: #fff; border-radius: 16px; box-shadow: 0 18px 50px rgba(15, 27, 51, .25), 0 0 0 1px rgba(15, 27, 51, .06); padding: 10px; animation: pd-pop .18s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes pd-pop { from { opacity: 0; transform: scale(.94); } }
.pd-menu-card::before { content: ""; position: absolute; left: -7px; top: calc(var(--ay, 50%) - 7px); width: 14px; height: 14px; background: #fff; transform: rotate(45deg); box-shadow: -1px 1px 0 rgba(15, 27, 51, .06); border-radius: 2px; }
.pd-menu-card.flip::before { left: auto; right: -7px; box-shadow: 1px -1px 0 rgba(15, 27, 51, .06); }
.pd-menu-head { display: flex; align-items: center; gap: 10px; padding: 4px 4px 10px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.pd-menu-pin { width: 34px; height: 34px; border-radius: 10px; background: #fee2e2; color: #dc2626; display: grid; place-items: center; flex: none; }
.pd-menu-title { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.pd-menu-title b { font-size: 15px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd-menu-title small { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.pd-menu-head .pd-x { width: 30px; height: 30px; }
.pd-menu-acts { display: flex; flex-direction: column; gap: 6px; }
.pd-act { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 1.5px solid transparent; background: var(--panel2); border-radius: 12px; padding: 10px 12px; cursor: pointer; font: inherit; color: inherit; transition: background .15s, border-color .15s, transform .1s; }
.pd-act:hover { border-color: #b9cbea; background: #e9f0fc; }
.pd-act:active { transform: translateY(1px); }
.pd-act-ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.pd-act-view .pd-act-ico { background: var(--pd-accent); color: #fff; box-shadow: 0 3px 8px rgba(37, 99, 235, .35); }
.pd-act-build .pd-act-ico { background: var(--pd-warm); color: #fff; box-shadow: 0 3px 8px rgba(217, 119, 6, .35); }
.pd-act-build:hover { background: var(--pd-warm-soft); border-color: #f5cf8f; }
.pd-act-txt { display: flex; flex-direction: column; min-width: 0; }
.pd-act-txt b { font-size: 15px; font-weight: 800; }
.pd-act-txt small { font-size: 12.5px; color: var(--muted); }
.pd-act-view.empty .pd-act-ico { background: #c3d0e6; box-shadow: none; }

/* ----- Thẻ hộp thoại lớn ----- */
dialog.pd-editor, dialog.pd-viewer { width: min(1080px, calc(100vw - 24px)); max-width: none; max-height: calc(100dvh - 24px); }
dialog.pd-editor { width: min(860px, calc(100vw - 24px)); }
.pd-card { display: flex; flex-direction: column; background: #fff; border-radius: var(--pd-radius); box-shadow: 0 30px 80px rgba(15, 27, 51, .35); overflow: hidden; height: min(780px, calc(100dvh - 24px)); margin: 0; }
.pd-editor .pd-card { height: min(720px, calc(100dvh - 24px)); }

.pd-head { display: flex; align-items: center; gap: 14px; padding: 18px 20px 14px; background: linear-gradient(180deg, #f3f7fe, #fff); }
.pd-head-ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; flex: none; color: #fff; }
.pd-head-ico svg { width: 24px; height: 24px; }
.pd-head-ico.is-view { background: var(--pd-accent); box-shadow: 0 6px 16px rgba(37, 99, 235, .35); }
.pd-head-ico.is-build { background: var(--pd-warm); box-shadow: 0 6px 16px rgba(217, 119, 6, .35); }
.pd-head-txt { flex: 1; min-width: 0; }
.pd-eyebrow { margin: 0; font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--pd-accent); }
.pd-editor .pd-eyebrow { color: var(--pd-warm); }
.pd-title { margin: 2px 0 3px; font-size: 22px; font-weight: 800; color: var(--pd-ink); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-wrap: balance; }
.pd-sub { margin: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 5px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pd-sub svg { width: 14px; height: 14px; }
.pd-dot-sep { width: 4px; height: 4px; border-radius: 50%; background: #b6c2d6; margin: 0 5px; }
.pd-edit-btn { flex: none; }

/* Tabs */
.pd-tabs { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--line); background: #fff; overflow-x: auto; scrollbar-width: none; flex: none; }
.pd-tab { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 12px 14px 13px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 14.5px; font-weight: 700; cursor: pointer; white-space: nowrap; border-radius: 10px 10px 0 0; }
.pd-tab:hover { color: var(--text); background: var(--panel2); }
.pd-tab.on { color: var(--pd-accent); }
.pd-editor .pd-tab.on { color: var(--pd-warm); }
.pd-tab.on::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: currentColor; }
.pd-count { font-style: normal; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: #e7edf6; color: var(--muted); font-size: 12px; font-weight: 800; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.pd-tab.on .pd-count { background: var(--pd-accent); color: #fff; }
.pd-editor .pd-tab.on .pd-count { background: var(--pd-warm); }

.pd-body { flex: 1; min-height: 0; overflow: auto; background: #f7f9fd; }
.pd-panel { padding: 20px; min-height: 100%; }
.pd-panel[hidden] { display: none; }

/* ----- Form xây dựng ----- */
.pd-editor #pde-p-info { display: flex; flex-direction: column; gap: 16px; }
.pd-field { display: flex; flex-direction: column; gap: 6px; }
.pd-field.grow { flex: 1; }
.pd-label { font-weight: 800; font-size: 14px; color: var(--pd-ink); }
.pd-opt { font-weight: 600; color: var(--muted); font-size: 12.5px; margin-left: 4px; }
.pd-input { width: 100%; border: 1.5px solid var(--line); border-radius: 11px; background: #fff; padding: 10px 12px; font: inherit; font-size: 14.5px; color: var(--text); transition: border-color .15s, box-shadow .15s; }
.pd-input:hover { border-color: #b9cbea; }
.pd-input:focus { outline: none; border-color: var(--pd-warm); box-shadow: 0 0 0 4px rgba(217, 119, 6, .14); }
textarea.pd-input { resize: vertical; line-height: 1.55; }
.pd-desc { flex: 1; min-height: 220px; }
.pd-meta { align-self: flex-end; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pd-panel-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.pd-help { margin: 0; flex: 1; font-size: 13.5px; color: var(--muted); line-height: 1.5; text-wrap: pretty; }
.pd-help code { background: #e7edf6; padding: 1px 5px; border-radius: 5px; font-size: 12.5px; }
.pd-editor .pd-add.btn.primary { background: var(--pd-warm); border-color: var(--pd-warm); box-shadow: 0 2px 0 #b45309; flex: none; }
.pd-editor .pd-add.btn.primary:hover { background: #b45309; border-color: #b45309; }
.pd-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.pd-rows:empty::before { content: attr(data-empty); display: block; text-align: center; padding: 40px 16px; border: 2px dashed var(--line); border-radius: 14px; color: var(--muted); font-weight: 600; }
.pd-row { display: flex; gap: 14px; padding: 12px; background: #fff; border: 1.5px solid var(--line); border-radius: 14px; transition: border-color .15s, box-shadow .15s; }
.pd-row:focus-within { border-color: #f0c27d; box-shadow: 0 4px 14px rgba(217, 119, 6, .1); }
.pd-row.bad { border-color: #f5a3a3; background: #fffafa; }
.pd-thumb { position: relative; width: 132px; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: #eef2f8; flex: none; display: grid; place-items: center; color: #9fb0ca; }
.pd-thumb.video { aspect-ratio: 16 / 10; }
.pd-thumb svg { width: 28px; height: 28px; }
.pd-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pd-thumb img[hidden] { display: none; }
.pd-thumb-play { position: absolute; width: 34px; height: 34px; border-radius: 50%; background: rgba(15, 27, 51, .7); color: #fff; display: grid; place-items: center; }
.pd-thumb-play svg { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.pd-thumb img[hidden] ~ .pd-thumb-play { display: none; }
.pd-row-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.pd-row-top { display: flex; align-items: center; gap: 8px; }
.pd-num { width: 26px; height: 26px; border-radius: 8px; background: var(--pd-warm-soft); color: var(--pd-warm); font-weight: 800; font-size: 13px; display: grid; place-items: center; flex: none; }
.pd-row .pd-input { padding: 8px 10px; font-size: 14px; }
.pd-cap { min-height: 44px; }
.pd-row-msg { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: #b45309; }
.pd-row-msg.err { color: #dc2626; }
.pd-row-msg svg { width: 15px; height: 15px; }
.pd-row-msg[hidden] { display: none; }
.pd-row-acts { display: flex; flex-direction: column; gap: 4px; }
.pd-icon-btn { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.pd-icon-btn svg { width: 16px; height: 16px; }
.pd-icon-btn:hover { color: var(--text); border-color: #b9cbea; background: var(--panel2); }
.pd-icon-btn.danger:hover { color: #dc2626; border-color: #f5c2cc; background: #fff1f3; }
.pd-row:first-child [data-row="up"], .pd-row:last-child [data-row="down"] { opacity: .35; pointer-events: none; }

.pd-foot { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); background: #fff; flex: none; }
.pd-foot-sp { flex: 1; }
.pd-store-note { font-size: 12.5px; color: var(--muted); }
.pd-del-all[hidden] { display: none; }
.pd-editor .pd-save.btn.primary { min-width: 130px; }

/* ----- Xem dữ liệu: tab Thông tin ----- */
.pd-info { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.pd-info-main { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 22px 26px; min-height: 100%; }
.pd-section-title { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--pd-accent); }
.pd-prose { font-size: 16px; line-height: 1.75; color: #24324d; text-wrap: pretty; }
.pd-prose p { margin: 0 0 14px; }
.pd-prose p:last-child { margin-bottom: 0; }
.pd-prose a { color: var(--pd-accent); word-break: break-all; }
.pd-info-side { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 0; }
.pd-cover { position: relative; margin: 0; border-radius: 16px; overflow: hidden; aspect-ratio: 4 / 3; background: #e7edf6; cursor: zoom-in; box-shadow: 0 6px 18px rgba(15, 27, 51, .12); }
.pd-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s; }
.pd-cover:hover img { transform: scale(1.04); }
.pd-cover figcaption { position: absolute; right: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 999px; background: rgba(15, 27, 51, .72); color: #fff; font-size: 12.5px; font-weight: 700; backdrop-filter: blur(4px); }
.pd-cover figcaption svg { width: 14px; height: 14px; }
.pd-cover.broken img, .pd-cover-strip .broken img { visibility: hidden; }
.pd-cover-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pd-cover-strip button { position: relative; padding: 0; border: 0; border-radius: 10px; overflow: hidden; aspect-ratio: 1; background: #e7edf6; cursor: pointer; }
.pd-cover-strip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pd-cover-strip button span { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(15, 27, 51, .55); color: #fff; font-weight: 800; }
.pd-facts { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.pd-fact { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 0; background: none; text-align: left; font: inherit; color: inherit; width: 100%; }
.pd-fact + .pd-fact { border-top: 1px solid var(--line); }
.pd-fact > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pd-fact small { font-size: 12px; color: var(--muted); }
.pd-fact b { font-size: 14.5px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd-fact.link { cursor: pointer; }
.pd-fact.link:hover { background: var(--panel2); }
.pd-fact.link > svg { color: var(--muted); }
.pd-fact-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: #fee2e2; color: #dc2626; flex: none; }
.pd-fact-ico.img { background: var(--pd-accent-soft); color: var(--pd-accent); }
.pd-fact-ico.vid { background: var(--pd-warm-soft); color: var(--pd-warm); }
.pd-copy { display: inline-flex; align-items: center; gap: 4px; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--muted); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.pd-copy svg { width: 13px; height: 13px; }
.pd-copy:hover { color: var(--text); }
.pd-copy.done { color: #15803d; border-color: #a7e3bd; background: #effbf3; }

/* Trạng thái trống */
.pd-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; padding: 60px 20px; color: var(--muted); min-height: 100%; }
.pd-empty > svg { width: 48px; height: 48px; padding: 12px; border-radius: 16px; background: #e7edf6; color: #8a9bb8; margin-bottom: 6px; stroke-width: 1.6; }
.pd-empty b { color: var(--pd-ink); font-size: 16px; }
.pd-empty .btn { margin-top: 10px; }
.pd-empty.small { padding: 30px 10px; min-height: 0; }

/* ----- Ảnh / Video ----- */
.pd-media-panel { padding: 0; height: 100%; }
.pd-media { display: flex; height: 100%; min-height: 420px; }
.pd-mlist { width: 280px; flex: none; display: flex; flex-direction: column; background: #fff; border-right: 1px solid var(--line); min-height: 0; }
.pd-mlist-head { margin: 0; padding: 14px 16px 10px; font-size: 12.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.pd-mlist-head span { background: #e7edf6; border-radius: 999px; padding: 1px 8px; letter-spacing: 0; }
.pd-mlist ol { list-style: none; margin: 0; padding: 0 10px 12px; overflow: auto; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.pd-mitem { display: flex; gap: 10px; align-items: center; width: 100%; padding: 8px; border: 1.5px solid transparent; border-radius: 12px; background: none; text-align: left; cursor: pointer; font: inherit; color: inherit; transition: background .15s, border-color .15s; }
.pd-mitem:hover { background: var(--panel2); }
.pd-mitem.on { background: var(--pd-accent-soft); border-color: #a9c1f5; }
.pd-mthumb { position: relative; width: 84px; aspect-ratio: 4 / 3; border-radius: 9px; overflow: hidden; background: #e7edf6; flex: none; }
.pd-mthumb.video { aspect-ratio: 16 / 10; }
.pd-mthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pd-mthumb.broken img { visibility: hidden; }
.pd-mthumb i { position: absolute; inset: 0; display: grid; place-items: center; }
.pd-mthumb i svg { width: 22px; height: 22px; padding: 5px; border-radius: 50%; background: rgba(220, 38, 38, .92); color: #fff; fill: currentColor; stroke: none; }
.pd-mtext { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pd-mtext b { font-size: 13.5px; font-weight: 800; }
.pd-mitem.on .pd-mtext b { color: var(--pd-accent); }
.pd-mtext small { font-size: 12.5px; color: var(--muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.pd-stage-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 16px; gap: 12px; }
.pd-stage { position: relative; flex: 1; min-height: 260px; border-radius: 16px; overflow: hidden; background: radial-gradient(ellipse at center, #1e2b45, #0b1222); display: grid; place-items: center; }
.pd-stage.video { flex: none; aspect-ratio: 16 / 9; max-height: calc(100% - 90px); width: 100%; min-height: 0; }
.pd-stage-inner { position: absolute; inset: 0; display: grid; place-items: center; }
.pd-stage-img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; animation: pd-fade .25s ease; }
@keyframes pd-fade { from { opacity: 0; } }
.pd-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.pd-stage-err { display: flex; flex-direction: column; align-items: center; gap: 8px; color: #c3cfe4; font-weight: 700; }
.pd-stage-err[hidden] { display: none; }
.pd-stage-err svg { width: 32px; height: 32px; }
.pd-poster { position: absolute; inset: 0; padding: 0; border: 0; cursor: pointer; background: #000; }
.pd-poster img { width: 100%; height: 100%; object-fit: cover; opacity: .85; transition: opacity .2s; }
.pd-poster:hover img { opacity: 1; }
.pd-poster-play { position: absolute; left: 50%; top: 50%; width: 72px; height: 50px; margin: -25px 0 0 -36px; border-radius: 14px; background: #dc2626; color: #fff; display: grid; place-items: center; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); transition: transform .15s; }
.pd-poster:hover .pd-poster-play { transform: scale(1.08); }
.pd-poster-play svg { width: 26px; height: 26px; fill: currentColor; stroke: none; }
.pd-nav { position: absolute; top: 50%; width: 42px; height: 42px; margin-top: -21px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .92); color: var(--pd-ink); display: grid; place-items: center; cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); opacity: 0; transition: opacity .2s, transform .15s; z-index: 2; }
.pd-nav.prev { left: 12px; } .pd-nav.next { right: 12px; }
.pd-stage:hover .pd-nav, .pd-nav:focus-visible { opacity: 1; }
.pd-nav:hover { transform: scale(1.06); }
.pd-stage.video .pd-nav { top: auto; bottom: 12px; margin-top: 0; }
.pd-counter { position: absolute; left: 12px; top: 12px; padding: 4px 10px; border-radius: 999px; background: rgba(15, 27, 51, .7); color: #fff; font-size: 12.5px; font-weight: 800; font-variant-numeric: tabular-nums; z-index: 2; pointer-events: none; }
.pd-caption { display: flex; align-items: flex-start; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; flex: none; }
.pd-caption-txt { flex: 1; min-width: 0; }
.pd-caption-txt b { font-size: 13px; font-weight: 800; color: var(--pd-accent); font-variant-numeric: tabular-nums; }
.pd-caption-txt p { margin: 3px 0 0; font-size: 15px; line-height: 1.6; color: #24324d; max-height: 7.5em; overflow: auto; }
.pd-caption-txt p.muted { color: var(--muted); font-style: italic; font-size: 14px; }
.pd-open { flex: none; text-decoration: none; }

/* ----- Biểu tượng emoji trên bản đồ ----- */
.pd-emoji, .pl-dot.pd-emoji-dot, .pd-ip-opt, .pd-ip-dot.emoji, .pl-go i.pd-emoji-i { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Nunito", system-ui, sans-serif; }
.pl-dot.pd-emoji-dot { left: 0; top: 0; transform: translate(-50%, -50%); width: auto; min-width: 30px; height: 30px; padding: 0 5px; border-radius: 999px; background: #fff; border: 2px solid #fff; box-shadow: 0 0 0 2px rgba(239, 68, 68, .7), 0 3px 8px rgba(15, 27, 51, .35); display: grid; place-items: center; font-size: 17px; line-height: 1; font-weight: 800; color: var(--pd-ink, #0f1b33); white-space: nowrap; }
.pl-marker.has-data .pl-dot.pd-emoji-dot { background: #fff; box-shadow: 0 0 0 2px #2563eb, 0 0 0 6px rgba(37, 99, 235, .18), 0 3px 8px rgba(15, 27, 51, .35); }
.pl-marker.has-icon .pl-tag { left: 20px; }
.pl-marker.has-icon .pd-badge { left: -24px; top: -25px; }
.pl-go i.pd-emoji-i { width: auto; height: auto; background: none !important; box-shadow: none !important; border-radius: 0; font-style: normal; font-size: 15px; line-height: 1; }

/* Chọn biểu tượng (xây dựng) */
.pd-iconpick { display: flex; gap: 14px; padding: 12px; background: #fff; border: 1.5px solid var(--line); border-radius: 14px; }
.pd-ip-preview { flex: none; width: 128px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border-radius: 11px; background: linear-gradient(135deg, #dfeee2, #cfe3f4); padding: 14px 8px; }
.pd-ip-preview small { font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #48607e; }
.pd-ip-map { display: flex; align-items: center; gap: 6px; max-width: 100%; }
.pd-ip-dot { flex: none; width: 13px; height: 13px; border-radius: 50%; background: #ef4444; border: 2px solid #fff; box-shadow: 0 0 0 3px rgba(239, 68, 68, .35); }
.pd-ip-dot.emoji { width: auto; min-width: 34px; height: 34px; padding: 0 6px; border-radius: 999px; background: #fff; box-shadow: 0 0 0 2px rgba(239, 68, 68, .7), 0 3px 8px rgba(15, 27, 51, .3); display: grid; place-items: center; font-size: 19px; line-height: 1; font-weight: 800; white-space: nowrap; }
.pd-ip-tag { min-width: 0; padding: 2px 6px; border-radius: 6px; background: rgba(255, 255, 255, .96); border: 1px solid rgba(239, 68, 68, .6); font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd-ip-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.pd-ip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 4px; max-height: 128px; overflow-y: auto; padding: 2px; }
.pd-ip-opt { height: 38px; border: 1.5px solid transparent; border-radius: 10px; background: var(--panel2); font-size: 20px; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0; transition: background .12s, border-color .12s, transform .12s; }
.pd-ip-opt:hover { background: var(--pd-warm-soft); transform: scale(1.08); }
.pd-ip-opt.on { border-color: var(--pd-warm); background: var(--pd-warm-soft); box-shadow: 0 0 0 3px rgba(217, 119, 6, .18); }
.pd-ip-opt.is-default i { width: 13px; height: 13px; border-radius: 50%; background: #ef4444; border: 2px solid #fff; box-shadow: 0 0 0 3px rgba(239, 68, 68, .3); }
.pd-ip-custom { display: flex; align-items: center; gap: 8px; }
.pd-ip-custom-ico { width: 36px; height: 36px; border-radius: 10px; background: var(--pd-warm-soft); color: var(--pd-warm); display: grid; place-items: center; flex: none; }
.pd-ip-input { flex: 1; min-width: 0; padding: 8px 12px; font-size: 16px; }

/* ----- Trắc nghiệm: xây dựng ----- */
.pd-qlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; counter-reset: q; }
.pd-qlist:empty::before { content: attr(data-empty); display: block; text-align: center; padding: 48px 16px; border: 2px dashed var(--line); border-radius: 14px; color: var(--muted); font-weight: 600; }
.pd-q { background: #fff; border: 1.5px solid var(--line); border-radius: 16px; overflow: hidden; transition: border-color .15s, box-shadow .15s; scroll-margin-top: 12px; }
.pd-q:focus-within { border-color: #f0c27d; box-shadow: 0 6px 18px rgba(217, 119, 6, .1); }
.pd-q.bad { border-color: #f5a3a3; }
.pd-q-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 14px; background: linear-gradient(180deg, #fffaf1, #fff); border-bottom: 1px solid var(--line); }
.pd-q-num { padding: 4px 12px; border-radius: 999px; background: var(--pd-warm); color: #fff; font-weight: 800; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.pd-q-kind { font-size: 12.5px; font-weight: 800; padding: 3px 10px; border-radius: 999px; }
.pd-q-kind.single { background: #e8efff; color: #1d4ed8; }
.pd-q-kind.multi { background: #ede9fe; color: #6d28d9; }
.pd-q-kind.none { background: #fff1f3; color: #dc2626; }
.pd-q:first-child [data-q="up"], .pd-q:last-child [data-q="down"] { opacity: .35; pointer-events: none; }
.pd-q-body { padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.pd-q .pd-label { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pd-q .pd-label > svg { width: 16px; height: 16px; color: var(--pd-warm); }
.pd-q-text { font-size: 15.5px; font-weight: 600; }
.pd-q-sec { display: flex; flex-direction: column; gap: 8px; }
.pd-q-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pd-q-sec-head .btn.mini svg { width: 14px; height: 14px; }
.pd-qm-list, .pd-qo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pd-qm { display: flex; align-items: flex-start; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfe; }
.pd-qm-thumb { position: relative; width: 88px; aspect-ratio: 16 / 10; border-radius: 8px; overflow: hidden; background: #eef2f8; color: #9fb0ca; display: grid; place-items: center; flex: none; }
.pd-qm-thumb svg { width: 22px; height: 22px; }
.pd-qm-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pd-qm-thumb img[hidden], .pd-qm-play[hidden] { display: none; }
.pd-qm-play { position: absolute; width: 26px; height: 26px; border-radius: 50%; background: rgba(220, 38, 38, .92); color: #fff; display: grid; place-items: center; }
.pd-qm-play svg { width: 12px; height: 12px; fill: currentColor; stroke: none; }
.pd-qm-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pd-q .pd-qm .pd-input, .pd-q .pd-qo .pd-input { padding: 7px 10px; font-size: 14px; }
.pd-qm-msg { margin: 0; font-size: 12.5px; font-weight: 700; color: #b45309; }
.pd-qm-msg.err { color: #dc2626; }
.pd-qm-msg[hidden] { display: none; }
.pd-qo { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 8px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; transition: border-color .15s, background .15s; }
.pd-qo.is-correct { border-color: #86d7a5; background: #f0fbf4; }
.pd-qo-letter { width: 30px; height: 30px; border-radius: 50%; background: #eef3fb; color: #1d4ed8; font-weight: 800; font-size: 14px; display: grid; place-items: center; flex: none; }
.pd-qo.is-correct .pd-qo-letter { background: #16a34a; color: #fff; }
.pd-qo-text { flex: 1; min-width: 0; }
.pd-qo-correct { position: relative; flex: none; cursor: pointer; }
.pd-qo-correct input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pd-qo-correct span { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 9px; border: 1.5px solid var(--line); background: #fff; color: var(--muted); font-size: 13px; font-weight: 800; transition: all .15s; user-select: none; }
.pd-qo-correct span svg { width: 14px; height: 14px; opacity: .35; }
.pd-qo-correct:hover span { border-color: #86d7a5; color: #15803d; }
.pd-qo-correct input:checked + span { background: #16a34a; border-color: #16a34a; color: #fff; }
.pd-qo-correct input:checked + span svg { opacity: 1; }
.pd-qo-correct input:focus-visible + span { outline: 2.5px solid var(--pd-warm); outline-offset: 2px; }
.pd-q-exp { min-height: 52px; }
.pd-q-addbig { margin-top: 14px; width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px; border: 2px dashed #f0c27d; border-radius: 14px; background: var(--pd-warm-soft); color: #b45309; font: inherit; font-weight: 800; cursor: pointer; transition: background .15s; }
.pd-q-addbig:hover { background: #ffe9c4; }
.pd-q-addbig[hidden] { display: none; }

/* ----- Trắc nghiệm: trình chiếu ----- */
.pd-fact-ico.quiz { background: #ede9fe; color: #6d28d9; }
.pd-quiz-panel { padding: 0; height: 100%; }
.pd-quiz { display: flex; flex-direction: column; height: 100%; min-height: 440px; outline: none; }
.pd-qz-top { display: flex; align-items: center; gap: 18px; padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--line); flex: none; }
.pd-qz-progress { width: 170px; flex: none; display: flex; flex-direction: column; gap: 6px; }
.pd-qz-count { font-size: 13px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.pd-qz-count b { font-size: 18px; color: var(--pd-ink); }
.pd-qz-bar { display: block; height: 6px; border-radius: 99px; background: #e7edf6; overflow: hidden; }
.pd-qz-bar i { display: block; height: 100%; border-radius: inherit; background: var(--pd-accent); transition: width .3s ease; }
.pd-qz-dots { list-style: none; margin: 0; padding: 3px; display: flex; gap: 6px; overflow-x: auto; flex: 1; min-width: 0; scrollbar-width: thin; }
.pd-qz-dot { width: 34px; height: 34px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; color: var(--muted); font: inherit; font-size: 13.5px; font-weight: 800; cursor: pointer; display: grid; place-items: center; font-variant-numeric: tabular-nums; transition: all .15s; flex: none; }
.pd-qz-dot:hover { border-color: #a9c1f5; color: var(--pd-ink); }
.pd-qz-dot.done { border-color: var(--pd-accent); color: var(--pd-accent); background: var(--pd-accent-soft); }
.pd-qz-dot.right { border-color: #16a34a; background: #dcfce7; color: #15803d; }
.pd-qz-dot.wrong { border-color: #ef4444; background: #fee2e2; color: #dc2626; }
.pd-qz-dot.shown { border-color: #a78bfa; background: #ede9fe; color: #6d28d9; }
.pd-qz-dot.on { background: var(--pd-accent); border-color: var(--pd-accent); color: #fff; box-shadow: 0 4px 10px rgba(37, 99, 235, .35); transform: translateY(-1px); }

.pd-qz-page { flex: 1; min-height: 0; overflow: auto; padding: 24px 24px 28px; }
.pd-qz-card { max-width: 1000px; margin: 0 auto; }
.pd-qz-card.from-right { animation: pd-qz-r .28s cubic-bezier(.2, .8, .3, 1); }
.pd-qz-card.from-left { animation: pd-qz-l .28s cubic-bezier(.2, .8, .3, 1); }
@keyframes pd-qz-r { from { opacity: 0; transform: translateX(28px); } }
@keyframes pd-qz-l { from { opacity: 0; transform: translateX(-28px); } }
@media (prefers-reduced-motion: reduce) { .pd-qz-card { animation: none !important; } }
.pd-qz-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pd-qz-tag { padding: 4px 12px; border-radius: 999px; background: var(--pd-ink); color: #fff; font-size: 13px; font-weight: 800; }
.pd-qz-kind { display: inline-flex; align-items: center; gap: 4px; padding: 4px 11px; border-radius: 999px; background: var(--pd-accent-soft); color: #1d4ed8; font-size: 13px; font-weight: 800; }
.pd-qz-kind.multi { background: #ede9fe; color: #6d28d9; }
.pd-qz-kind svg { width: 14px; height: 14px; }
.pd-qz-q { margin: 12px 0 20px; font-size: 22px; font-weight: 800; line-height: 1.45; color: var(--pd-ink); text-wrap: pretty; }
.pd-qz-q p { margin: 0 0 8px; }
.pd-qz-q p:last-child { margin: 0; }
.pd-qz-grid { display: grid; gap: 20px; }
.pd-qz-grid.has-media { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; }

.pd-qz-media { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.pd-qz-stage { position: relative; aspect-ratio: 4 / 3; border-radius: 16px; overflow: hidden; background: radial-gradient(ellipse at center, #1e2b45, #0b1222); display: grid; place-items: center; box-shadow: 0 8px 22px rgba(15, 27, 51, .15); }
.pd-qz-stage.video { aspect-ratio: 16 / 9; }
.pd-qz-imglink { position: absolute; inset: 0; display: grid; place-items: center; cursor: zoom-in; }
.pd-qz-imglink[hidden] { display: none; }
.pd-qz-img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; animation: pd-fade .25s ease; }
.pd-qz-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.pd-qz-media figcaption { font-size: 14px; color: #3a4a66; line-height: 1.5; padding: 0 4px; }
.pd-qz-thumbs { display: flex; gap: 6px; overflow-x: auto; padding: 2px; }
.pd-qz-thumb { position: relative; width: 72px; aspect-ratio: 4 / 3; flex: none; padding: 0; border: 2px solid transparent; border-radius: 9px; overflow: hidden; background: #e7edf6; cursor: pointer; opacity: .7; transition: opacity .15s, border-color .15s; }
.pd-qz-thumb:hover { opacity: 1; }
.pd-qz-thumb.on { opacity: 1; border-color: var(--pd-accent); }
.pd-qz-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pd-qz-thumb.broken img { visibility: hidden; }
.pd-qz-thumb i { position: absolute; inset: 0; display: grid; place-items: center; }
.pd-qz-thumb i svg { width: 20px; height: 20px; padding: 5px; border-radius: 50%; background: rgba(220, 38, 38, .92); color: #fff; fill: currentColor; stroke: none; }

.pd-qz-opts { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; align-content: start; }
.pd-qz-opts.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pd-qz-opt { width: 100%; height: 100%; display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 2px solid var(--line); border-radius: 14px; background: #fff; color: var(--text); text-align: left; font: inherit; font-size: 16.5px; font-weight: 600; line-height: 1.4; cursor: pointer; transition: border-color .15s, background .15s, transform .1s, box-shadow .15s, opacity .15s; }
.pd-qz-opt:hover:not([aria-disabled="true"]) { border-color: #a9c1f5; background: #f7faff; box-shadow: 0 4px 12px rgba(37, 99, 235, .1); }
.pd-qz-opt:active:not([aria-disabled="true"]) { transform: scale(.99); }
.pd-qz-opt[aria-disabled="true"] { cursor: default; }
.pd-qz-letter { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none; background: #eef3fb; color: #1d4ed8; font-weight: 800; font-size: 16px; transition: all .15s; }
.pd-qz-opts.multi .pd-qz-letter { border-radius: 10px; }
.pd-qz-otext { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pd-qz-mark { flex: none; width: 28px; height: 28px; display: grid; place-items: center; }
.pd-qz-mark:empty { display: none; }
.pd-qz-mark svg { width: 22px; height: 22px; stroke-width: 3; }
.pd-qz-opt.sel { border-color: var(--pd-accent); background: var(--pd-accent-soft); }
.pd-qz-opt.sel .pd-qz-letter { background: var(--pd-accent); color: #fff; }
.pd-qz-opt.right { border-color: #16a34a; background: #effbf3; color: #14532d; box-shadow: 0 0 0 3px rgba(22, 163, 74, .12); }
.pd-qz-opt.right .pd-qz-letter { background: #16a34a; color: #fff; }
.pd-qz-opt.right .pd-qz-mark { color: #16a34a; }
.pd-qz-opt.wrong { border-color: #ef4444; background: #fff1f3; color: #7f1d1d; }
.pd-qz-opt.wrong .pd-qz-letter { background: #ef4444; color: #fff; }
.pd-qz-opt.wrong .pd-qz-mark { color: #dc2626; }
.pd-qz-opt.dim { opacity: .55; }

.pd-qz-result { display: flex; gap: 14px; margin-top: 20px; padding: 16px 18px; border-radius: 14px; border: 1.5px solid; animation: pd-in .25s ease; }
.pd-qz-result.ok { background: #effbf3; border-color: #86d7a5; }
.pd-qz-result.bad { background: #fff5f5; border-color: #f5a3a3; }
.pd-qz-result.info { background: #f5f3ff; border-color: #c4b5fd; }
.pd-qz-result-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; color: #fff; }
.pd-qz-result.ok .pd-qz-result-ico { background: #16a34a; }
.pd-qz-result.bad .pd-qz-result-ico { background: #ef4444; }
.pd-qz-result.info .pd-qz-result-ico { background: #7c3aed; }
.pd-qz-result-ico svg { width: 22px; height: 22px; stroke-width: 2.6; }
.pd-qz-result-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pd-qz-result-txt > b { font-size: 17px; font-weight: 800; color: var(--pd-ink); }
.pd-qz-result-txt > span { font-size: 14.5px; color: #3a4a66; }
.pd-qz-exp { margin-top: 8px; padding-top: 10px; border-top: 1px dashed rgba(15, 27, 51, .15); font-size: 15px; line-height: 1.65; color: #24324d; }
.pd-qz-exp p { margin: 0 0 8px; }
.pd-qz-exp p:last-child { margin: 0; }

.pd-qz-foot { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--line); background: #fff; flex: none; }
.pd-qz-keys { margin: 0; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.pd-qz-keys span { margin: 0 2px; }
.pd-qz-keys kbd { min-width: 22px; padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: var(--panel2); font: 700 11.5px ui-monospace, monospace; color: var(--pd-ink); text-align: center; }
.pd-qz-reveal.on { color: #6d28d9; border-color: #c4b5fd; background: #f5f3ff; }
.pd-qz-next.btn.primary, .pd-qz-prev.btn { min-width: 120px; }

/* ----- Responsive ----- */
@media (max-width: 960px) {
  .pd-qz-grid.has-media { grid-template-columns: 1fr; }
  .pd-qz-stage { aspect-ratio: 16 / 10; }
}
@media (max-width: 860px) {
  .pd-info { grid-template-columns: 1fr; }
  .pd-info-side { position: static; order: -1; }
  .pd-cover { aspect-ratio: 16 / 9; }
}
@media (max-width: 720px) {
  dialog.pd-editor, dialog.pd-viewer { width: 100vw; max-height: 100dvh; }
  .pd-card, .pd-editor .pd-card { height: 100dvh; border-radius: 0; }
  .pd-head { padding: 14px 14px 10px; gap: 10px; }
  .pd-head-ico { width: 40px; height: 40px; }
  .pd-title { font-size: 18px; }
  .pd-edit-btn span { display: none; }
  .pd-panel { padding: 14px; }
  .pd-info-main { padding: 18px; }
  .pd-media { flex-direction: column; min-height: 0; }
  .pd-mlist { width: auto; order: 2; border-right: 0; border-top: 1px solid var(--line); }
  .pd-mlist ol { flex-direction: row; overflow-x: auto; padding-bottom: 12px; }
  .pd-mitem { flex-direction: column; align-items: stretch; width: 120px; flex: none; }
  .pd-mthumb { width: 100%; }
  .pd-stage-wrap { padding: 12px; }
  .pd-stage { min-height: 240px; flex: none; aspect-ratio: 4 / 3; }
  .pd-stage.video { aspect-ratio: 16 / 9; max-height: none; }
  .pd-nav { opacity: 1; width: 36px; height: 36px; margin-top: -18px; }
  .pd-panel-head { flex-direction: column; align-items: stretch; }
  .pd-row { flex-wrap: wrap; }
  .pd-thumb { width: 96px; }
  .pd-row-acts { flex-direction: row; width: 100%; justify-content: flex-end; }
  .pd-store-note { display: none; }
  .pd-foot { padding: 12px 14px; }
  .pd-iconpick { flex-direction: column; }
  .pd-ip-preview { width: auto; flex-direction: row; justify-content: space-between; padding: 10px 14px; }
  .pd-qm { flex-wrap: wrap; }
  .pd-qo { flex-wrap: wrap; }
  .pd-qo-text { flex-basis: calc(100% - 120px); }
  .pd-qz-top { padding: 10px 14px; gap: 12px; }
  .pd-qz-progress { width: 96px; }
  .pd-qz-page { padding: 16px 14px 20px; }
  .pd-qz-q { font-size: 18px; }
  .pd-qz-opts.two { grid-template-columns: 1fr; }
  .pd-qz-opt { font-size: 15px; padding: 12px; }
  .pd-qz-keys { display: none; }
  .pd-qz-foot { padding: 10px 14px; }
  .pd-qz-next.btn.primary, .pd-qz-prev.btn { min-width: 0; }
  .pd-qz-prev span, .pd-qz-reveal span { display: none; }
}

/* ===== Trợ lý AI (DeepSeek) ===== */
.ai-btn.is-on { border-color: #a7c4f5; color: var(--teal); }
.ai-btn.is-on::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #16a34a; margin-left: 2px; }

dialog.pd-ai { width: min(520px, calc(100vw - 24px)); max-width: none; }
.pd-ai-card { height: auto; }
.pd-head-ico.is-ai { background: linear-gradient(135deg, #2563eb, #7c3aed); box-shadow: 0 6px 16px rgba(91, 76, 230, .35); }
.pd-ai .pd-eyebrow { color: #5b4ce6; }
.pd-ai-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 16px; }
.pd-ai .pd-label { display: inline-flex; align-items: center; gap: 6px; }
.pd-ai .pd-label svg { width: 16px; height: 16px; }
.pd-ai-keyrow { display: flex; gap: 8px; align-items: center; }
.pd-ai-keyrow .pd-input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .02em; }
.pd-ai .pd-help a { color: var(--pd-accent); font-weight: 700; }
.pd-ai-msg, .pd-ai-gen-msg { margin: 0; font-size: 13.5px; font-weight: 700; color: var(--muted); min-height: 1.3em; }
.pd-ai-msg.ok, .pd-ai-gen-msg.ok { color: #15803d; }
.pd-ai-msg.err, .pd-ai-gen-msg.err { color: var(--red); }
.pd-ai-msg.warn { color: #b45309; }

.pd-ai-gen { margin: 0 0 16px; border: 1.5px solid #c9d6f5; border-radius: 14px; background: linear-gradient(180deg, #f3f6ff, #fff); overflow: hidden; }
.pd-ai-gen > summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; user-select: none; }
.pd-ai-gen > summary::-webkit-details-marker { display: none; }
.pd-ai-gen > summary > svg { color: var(--muted); transition: transform .2s; }
.pd-ai-gen[open] > summary > svg { transform: rotate(180deg); }
.pd-ai-gen-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; color: #fff; background: linear-gradient(135deg, #2563eb, #7c3aed); }
.pd-ai-gen-ttl { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pd-ai-gen-ttl b { font-size: 15px; font-weight: 800; color: var(--pd-ink); }
.pd-ai-gen-ttl small { font-size: 12.5px; color: var(--muted); }
.pd-ai-gen-state { font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: #dcfce7; color: #15803d; white-space: nowrap; }
.pd-ai-gen.no-key .pd-ai-gen-state { background: #fee2e2; color: #b91c1c; }
.pd-ai-gen-body { padding: 4px 14px 14px; display: flex; flex-direction: column; gap: 12px; border-top: 1px solid #dfe7fa; padding-top: 14px; }
.pd-ai-gen .pd-input:focus { border-color: #5b4ce6; box-shadow: 0 0 0 4px rgba(91, 76, 230, .14); }
.pd-ai-gen-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.pd-ai-desc { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; color: var(--pd-ink); padding-bottom: 11px; cursor: pointer; }
.pd-ai-desc input { width: 17px; height: 17px; accent-color: #5b4ce6; }
.pd-ai-gen-acts { display: flex; align-items: center; gap: 10px; }
.pd-ai-gen-acts .pd-ai-gen-msg { flex: 1; }
.pd-ai-gen .pd-ai-run.btn.primary { background: #5b4ce6; border-color: #5b4ce6; box-shadow: 0 2px 0 #4338ca; min-width: 140px; }
.pd-ai-gen .pd-ai-run.btn.primary:hover { background: #4338ca; border-color: #4338ca; }
.pd-ai-gen.busy .pd-ai-run.btn.primary { background: #fff; color: var(--red); border-color: #f5c2cc; box-shadow: none; }
.pd-ai-gen.busy .pd-ai-run svg { animation: pd-ai-spin 1.2s linear infinite; }
.pd-ai-gen.busy .pd-ai-gen-msg:not(.ok):not(.err)::after { content: ""; display: inline-block; width: 1em; animation: pd-ai-dots 1.2s steps(4) infinite; overflow: hidden; vertical-align: bottom; }
@keyframes pd-ai-spin { to { transform: rotate(360deg); } }
@keyframes pd-ai-dots { from { width: 0; } to { width: 1em; } }
.pd-q.is-ai { border-color: #c9d6f5; }
.pd-q.is-ai .pd-q-num::after { content: "AI"; margin-left: 6px; font-size: 10.5px; font-weight: 800; padding: 1px 6px; border-radius: 999px; background: #ede9fe; color: #5b4ce6; vertical-align: middle; }
@media (max-width: 640px) {
  .pd-ai-gen-row { grid-template-columns: 1fr 1fr; }
  .pd-ai-desc { grid-column: 1 / -1; padding-bottom: 0; }
  .pd-ai-gen-acts { flex-wrap: wrap; }
  .pd-ai-gen-acts .pd-ai-gen-msg { flex-basis: 100%; }
  .pd-ai-gen-acts .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { .pd-ai-gen.busy .pd-ai-run svg { animation: none; } }
