/* Egen kod, idé från affectUI Prompt Library (Pro), ingen kod tagen */
#c-b-prompt-library {
  --npl-ink: rgba(0,0,0,.88); --npl-text: rgba(0,0,0,.61);   --npl-line: rgba(0,0,0,.06); --npl-wash: rgba(0,0,0,.03); --npl-fill: rgba(0,0,0,.06);
  --npl-ember: #D9601C; --npl-ok: #1E7A4C;
  --npl-shadow: 0 0 0 .5px rgba(0,0,0,.06), 0 1px 1px -1px rgba(0,0,0,.1), 0 1px 2px 0 rgba(0,0,0,.05);
  --npl-ease: cubic-bezier(.22,1,.36,1);
  width: 100%; max-width: 100%; contain: inline-size; container-type: inline-size; font-family: var(--sans); font-size: 13px; line-height: 20px; color: var(--npl-ink); -webkit-font-smoothing: antialiased;
  --npl-card: #fff; --npl-strong: #000; --npl-solid: rgba(0,0,0,.88); --npl-on-solid: #fcfcfc; --npl-raised: #FBFAF8; --npl-rgb: 0,0,0;
  --npl-ember-ink: #B4501A; --npl-del: #A3402C; --npl-warn-ink: #7A4B05; --npl-toast: rgba(0,0,0,.86);
  --npl-te-bg: #F7E3D6; --npl-te-fg: #9A4310; --npl-tg-bg: #DDEDE4; --npl-tg-fg: #1E6A44; --npl-tn-bg: #ECEBE8; --npl-ty-bg: #F3E6C9; --npl-ty-fg: #7A5410;
}

#c-b-prompt-library *, #c-b-prompt-library *::before, #c-b-prompt-library *::after { box-sizing: border-box; }
:where(#c-b-prompt-library) button { margin: 0; padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; text-align: left; -webkit-tap-highlight-color: transparent; }
#c-b-prompt-library button:focus-visible, #c-b-prompt-library input:focus-visible { outline: 2px solid rgba(217,96,28,.4); outline-offset: 1px; }
#c-b-prompt-library svg { display: block; flex: none; }
.npl-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.npl-card { display: grid; grid-template-columns: 232px minmax(0, 1fr); grid-template-rows: 1fr auto; background: var(--npl-card); border-radius: 10px; box-shadow: var(--npl-shadow); }
.npl-side { padding: 14px 8px 10px; border-right: .5px solid var(--npl-line); }
.npl-side-head { display: flex; align-items: baseline; gap: 6px; padding: 0 8px 8px; }
.npl-h { margin: 0; font-size: 13px; line-height: 20px; font-weight: 600; color: var(--npl-strong); }
.npl-total { font-size: 12px; color: var(--grey); font-variant-numeric: tabular-nums; }
.npl-search { display: flex; align-items: center; gap: 6px; height: 30px; margin: 0 0 6px; padding: 0 8px; border-radius: 6px; box-shadow: inset 0 0 0 .5px rgba(var(--npl-rgb),.12); color: var(--grey); }
.npl-search:focus-within { box-shadow: inset 0 0 0 .5px rgba(var(--npl-rgb),.2), 0 0 0 3px rgba(217,96,28,.12); }
.npl-search svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.npl-q { flex: 1; min-width: 0; height: 28px; border: 0; padding: 0; background: transparent; font: inherit; color: var(--npl-ink); outline: none; }
#c-b-prompt-library .npl-q:focus-visible { outline: none; }
.npl-q::placeholder { color: var(--grey); }
.npl-list { display: grid; gap: 1px; }
.npl-item { display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 6px 8px; border-radius: 6px; color: var(--npl-text); transition: background-color 140ms ease, color 140ms ease; }
.npl-item:hover { background: var(--npl-wash); color: var(--npl-ink); }
.npl-item[aria-selected="true"] { background: var(--npl-fill); color: var(--npl-ink); }
.npl-item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.npl-empty { padding: 12px 8px; font-size: 12px; color: var(--grey); }
.npl-tag { display: inline-grid; place-items: center; height: 20px; padding: 0 6px; border-radius: 5px; font-size: 12px; line-height: 1; font-weight: 500; white-space: nowrap; }
.npl-tag[data-c="0"] { background: var(--npl-te-bg); color: var(--npl-te-fg); }
.npl-tag[data-c="1"] { background: var(--npl-tg-bg); color: var(--npl-tg-fg); }
.npl-tag[data-c="2"] { background: var(--npl-tn-bg); color: rgba(var(--npl-rgb),.66); }
.npl-tag[data-c="3"] { background: var(--npl-ty-bg); color: var(--npl-ty-fg); }

.npl-main { min-width: 0; padding: 14px 16px 14px; }
.npl-main-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.npl-title { margin: 0 auto 0 0; font-size: 13px; line-height: 20px; font-weight: 600; color: var(--npl-strong); }
.npl-prog { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--grey); font-variant-numeric: tabular-nums; white-space: nowrap; }
.npl-dots { display: inline-flex; gap: 2px; }
.npl-dots i { width: 6px; height: 6px; border-radius: 2px; background: var(--npl-fill); transition: background-color 240ms ease; }
.npl-dots i[data-on] { background: var(--npl-ember); }
.npl-prog[data-full] { color: var(--npl-ok); }
.npl-prog[data-full] .npl-dots i { background: var(--npl-ok); }

.npl-sentence { margin: 0; font-size: 14px; line-height: 32px; color: var(--npl-ink); text-wrap: pretty; }
.npl-field { position: relative; display: inline-block; vertical-align: baseline; max-width: 100%; }
.npl-in, .npl-measure { height: 26px; padding: 0 7px; border-radius: 6px; font: inherit; font-size: 14px; line-height: 26px; white-space: pre; }
.npl-in { position: absolute; inset: 0; width: 100%; min-width: 0; border: 0; background: var(--npl-wash); box-shadow: inset 0 0 0 .5px rgba(var(--npl-rgb),.14); color: var(--npl-strong); font-weight: 500; outline: none; transition: background-color 160ms ease, box-shadow 160ms ease; }
.npl-in::placeholder { color: var(--grey); font-weight: 400; }
.npl-in:focus { background: var(--npl-card); box-shadow: inset 0 0 0 1px rgba(217,96,28,.55), 0 0 0 3px rgba(217,96,28,.12); }
#c-b-prompt-library .npl-in:focus-visible { outline: none; }
.npl-in[data-filled] { background: rgba(217,96,28,.07); box-shadow: inset 0 0 0 .5px rgba(217,96,28,.3); }
.npl-measure { display: inline-block; visibility: hidden; font-weight: 500; min-width: 44px; vertical-align: baseline; }

.npl-prev-head { margin: 14px 0 6px; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--grey); }
.npl-preview { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--npl-raised); box-shadow: inset 0 0 0 .5px rgba(var(--npl-rgb),.08); color: var(--npl-text); text-wrap: pretty; }
.npl-preview b { font-weight: 500; color: var(--npl-strong); }
.npl-preview .npl-hole { color: var(--grey); font-family: var(--mono); font-size: 12px; }

.npl-foot { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; padding: 8px 10px 8px 16px; border-top: .5px solid var(--npl-line); }
.npl-tokens { margin-right: auto; white-space: nowrap; font-size: 12px; color: var(--grey); font-variant-numeric: tabular-nums; }
.npl-copy, .npl-use { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 6px; font-weight: 500; white-space: nowrap; transition: background-color 160ms ease, color 160ms ease, opacity 160ms ease; }
.npl-copy { box-shadow: var(--npl-shadow); }
.npl-copy:hover { background: var(--npl-wash); }
.npl-copy[data-done] { color: var(--npl-ok); }
.npl-use { background: var(--npl-solid); color: var(--npl-on-solid); }
.npl-use:hover:not(:disabled) { background: rgba(var(--npl-rgb),.78); }
.npl-use:disabled { background: var(--npl-fill); color: var(--grey); cursor: default; }
.npl-use[data-done] { background: rgba(30,122,76,.10); color: var(--npl-ok); }
.npl-copy svg, .npl-use svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* Smal ruta: listan ovanför, som en rad att scrolla */
@container (max-width: 560px) {
  .npl-card { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr auto; }
  .npl-side { border-right: 0; border-bottom: .5px solid var(--npl-line); padding: 12px 12px 10px; }
  .npl-side-head { padding: 0 0 8px; }
  .npl-list { display: flex; gap: 6px; overflow-x: auto; margin: 0 -12px; padding: 2px 12px 2px; scrollbar-width: none; }
  .npl-list::-webkit-scrollbar { display: none; }
  .npl-item { flex: none; box-shadow: inset 0 0 0 .5px rgba(var(--npl-rgb),.1); }
  .npl-item[aria-selected="true"] { box-shadow: none; }
  .npl-item-name { overflow: visible; }
  .npl-foot { grid-column: 1; }
}
@media (pointer: coarse) { .npl-copy, .npl-use { height: 36px; } }
@media (prefers-reduced-motion: reduce) {
  #c-b-prompt-library *, #c-b-prompt-library *::before, #c-b-prompt-library *::after { animation: none !important; transition: none !important; }
}

/* Mörkt läge, samma konvention som affectUI: data-theme="dark" eller .dark på en förälder */
:where(.dark, [data-theme="dark"]) #c-b-prompt-library {
  --npl-ink: rgba(255,255,255,.9); --npl-text: rgba(255,255,255,.64);   --npl-line: rgba(255,255,255,.08); --npl-wash: rgba(255,255,255,.04); --npl-fill: rgba(255,255,255,.08);
  --npl-card: #1C1B1A; --npl-strong: #fff; --npl-solid: rgba(255,255,255,.9); --npl-on-solid: #161615; --npl-raised: #232220; --npl-rgb: 255,255,255;
  --npl-ember-ink: #F08A4B; --npl-del: #FF8A73; --npl-warn-ink: #F0B232; --npl-ok: #3EC27A; --npl-toast: #2C2B29; --npl-wait: #F0B232;
  --npl-te-bg: rgba(217,96,28,.2); --npl-te-fg: #F5A06C; --npl-tg-bg: rgba(62,194,122,.15); --npl-tg-fg: #6FD49C; --npl-tn-bg: rgba(255,255,255,.1); --npl-ty-bg: rgba(240,178,50,.15); --npl-ty-fg: #F0B232;
  --npl-shadow: 0 0 0 .5px rgba(255,255,255,.1), 0 1px 2px rgba(0,0,0,.4);
  --npl-pop: 0 0 0 .5px rgba(255,255,255,.12), 0 12px 28px -10px rgba(0,0,0,.6), 0 1px 2px rgba(0,0,0,.4);
}
