/* Preserve legacy completion badges outside the resource catalogue. */
.study-completion-host{position:relative}
.study-completion-host>.completed-badge:not(.study-completion){display:inline-flex;gap:5px;align-items:center;color:#137449;background:#f1fff5;border:1px solid #bae2c8;border-radius:7px;padding:2px 7px;font-weight:700;font-size:.8rem;line-height:1.4}
.study-completion--green{--completion-fg:#14663c;--completion-bg:#edf9f0;--completion-border:#9dcca9}
.study-completion--red{--completion-fg:#ad242b;--completion-bg:#fff0f0;--completion-border:#e9a5aa}
.study-completion--orange{--completion-fg:#914000;--completion-bg:#fff4e7;--completion-border:#e9b57f}
.study-completion-host>.study-completion{position:static;display:flex;align-items:center;gap:12px;width:100%;box-sizing:border-box;margin:0 0 18px;padding:12px 14px;border:1px solid var(--completion-border);border-radius:14px;color:var(--completion-fg);background:var(--completion-bg);font-size:14px;line-height:1.4;text-align:left}
.study-completion-icon{flex:0 0 48px;display:grid;place-items:center;width:48px;height:48px;font-family:Arial,sans-serif;font-size:48px;font-weight:800;line-height:1;color:inherit}
.study-completion--orange :is(.study-completion-icon,.study-legend-icon){color:#c45b00}
.study-completion-copy{min-width:0;display:grid;gap:5px;color:inherit}
.study-completion-copy strong{color:inherit;font-size:15px;line-height:1.35}
.study-completion-copy>span{color:inherit;font-size:12px;line-height:1.5;font-weight:400}
.study-completion-legend{margin:12px 0 22px;padding:18px 20px;border:1px solid #d8ccec;border-radius:18px;background:#fff;color:#261e35}
.study-completion-legend>p:first-child{margin:0 0 12px}
.study-completion-legend>ul{display:flex;flex-wrap:wrap;gap:12px 24px;padding:0;margin:0 0 12px;list-style:none}
.study-completion-legend li{display:flex;gap:8px;align-items:center;color:var(--completion-fg);font-size:14px;line-height:1.5;font-weight:650}
.study-legend-icon{font-size:27px;line-height:1;font-weight:800}
.study-completion-legend .study-completion-note,.study-completion-legend details p{font-size:13px;line-height:1.65;margin:8px 0 0;color:inherit}
.study-completion-legend details{border:0;background:none;padding:0;margin:10px 0 0;border-radius:0;box-shadow:none}
.study-completion-legend details>summary{display:list-item;cursor:pointer;font-size:13px;min-height:32px;color:inherit;padding:3px 0;background:none;border:0;line-height:1.6;font-weight:600}
.study-completion-legend summary:focus-visible{outline:3px solid #674195;outline-offset:4px}
[data-theme=dark] .study-completion--green{--completion-fg:#a4ecc1;--completion-bg:#163026;--completion-border:#3a6e50}
[data-theme=dark] .study-completion--red{--completion-fg:#ffb5b9;--completion-bg:#3a2026;--completion-border:#8f4c54}
[data-theme=dark] .study-completion--orange{--completion-fg:#ffcb91;--completion-bg:#382a1e;--completion-border:#8e633b}
[data-theme=dark] .study-completion--orange :is(.study-completion-icon,.study-legend-icon){color:#ffb463}
[data-theme=dark] .study-completion-legend{background:#211a2d;color:#f0e9f8;border-color:#59476e}
@media(max-width:600px){.study-completion-legend{padding:16px}.study-completion-legend>ul{flex-direction:column;gap:10px}.study-completion-host>.study-completion{gap:10px;padding:10px 12px}.study-completion-copy strong{font-size:14px}}

.study-completion-host>.study-completion{color:var(--completion-fg);background:var(--completion-bg)}
.pl-set-row>.study-completion{grid-column:1/-1;flex-basis:100%;margin:0 0 8px}
.pl-set-row.study-completion-host{flex-wrap:wrap}
.study-completion-legend{clear:both;box-sizing:border-box;max-width:100%}

/* Compact rounded completion marks; independent of general paragraph/list colours. */
.study-completion--green{--completion-mark:#117c50}
.study-completion--orange{--completion-mark:#b86105}
.study-completion--red{--completion-mark:#c2354c}
html:root body :is(.study-completion-icon,.study-legend-icon){display:inline-flex!important;position:relative;align-items:center;justify-content:center;flex:0 0 18px!important;width:18px!important;height:18px!important;min-width:18px!important;min-height:18px!important;font-size:0!important;line-height:0!important;border:0!important;border-radius:50%!important;padding:0!important;overflow:hidden;background:var(--completion-mark,#117c50)!important;color:transparent!important}
html:root body :is(.study-completion-icon,.study-legend-icon)::before{content:"";display:block;width:14px;height:14px;background:#fff;-webkit-mask:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20d%3D%22M20%206%209%2017l-5-5%22%20fill%3D%22none%22%20stroke%3D%22white%22%20stroke-width%3D%222.6%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E") center/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20d%3D%22M20%206%209%2017l-5-5%22%20fill%3D%22none%22%20stroke%3D%22white%22%20stroke-width%3D%222.6%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E") center/contain no-repeat}
html:root body .study-completion-legend li{font-weight:500!important}

html:root body :is(main#main,main) :is([data-whole-study-card],a.card,a.il-set[data-completion-card]) > [data-history-completion].study-completion{position:absolute!important;top:50%!important;right:17px!important;transform:translateY(-50%)!important;display:flex!important;align-items:center!important;justify-content:center!important;z-index:2;width:18px!important;height:18px!important;min-width:18px!important;min-height:18px!important;max-width:18px!important;margin:0!important;padding:0!important;gap:0!important;border:0!important;border-radius:50%!important;background:transparent!important;box-shadow:none!important;pointer-events:none!important}
html:root body :is(main#main,main) :is([data-whole-study-card],a.card,a.il-set[data-completion-card]) > [data-history-completion].study-completion > .study-completion-icon{display:inline-flex!important}
html:root body :is(main#main,main) :is([data-whole-study-card],a.card,a.il-set[data-completion-card]) > [data-history-completion].study-completion > .study-completion-copy{display:none!important}
html:root body :is(main#main,main) :is([data-whole-study-card],a.card,a.il-set[data-completion-card]):has(> [data-history-completion].study-completion){position:relative;padding-right:52px!important}
