/* Egen kod, idé från affectUI Memory Panel (Pro), ingen kod tagen */
#c-b-memory-panel {
  --nmp-ink: rgba(0,0,0,.88); --nmp-text: rgba(0,0,0,.61);   --nmp-line: rgba(0,0,0,.06); --nmp-wash: rgba(0,0,0,.03); --nmp-fill: rgba(0,0,0,.06);
  --nmp-ember: #D9601C; --nmp-ok: #1E7A4C; --nmp-wait: #8A5200;
  --nmp-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);
  --nmp-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(--nmp-ink); -webkit-font-smoothing: antialiased;
  --nmp-card: #fff; --nmp-strong: #000; --nmp-solid: rgba(0,0,0,.88); --nmp-on-solid: #fcfcfc; --nmp-raised: #FBFAF8; --nmp-rgb: 0,0,0;
  --nmp-ember-ink: #B4501A; --nmp-del: #A3402C; --nmp-warn-ink: #7A4B05; --nmp-toast: rgba(0,0,0,.86);
  --nmp-te-bg: #F7E3D6; --nmp-te-fg: #9A4310; --nmp-tg-bg: #DDEDE4; --nmp-tg-fg: #1E6A44; --nmp-tn-bg: #ECEBE8; --nmp-ty-bg: #F3E6C9; --nmp-ty-fg: #7A5410;
}

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

.nmp-card { position: relative; background: var(--nmp-card); border-radius: 10px; box-shadow: var(--nmp-shadow); overflow: hidden; }
.nmp-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 8px 16px; }
.nmp-title { margin: 0; font-size: 14px; line-height: 20px; font-weight: 600; color: var(--nmp-strong); }
.nmp-count { display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 5px; background: var(--nmp-fill); font-size: 12px; font-variant-numeric: tabular-nums; color: var(--nmp-text); }
.nmp-switch-wrap { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; cursor: pointer; }
.nmp-switch-label { font-size: 12px; color: var(--nmp-text); white-space: nowrap; }
.nmp-switch { position: relative; width: 30px; height: 18px; border-radius: 9px; background: rgba(var(--nmp-rgb),.16); transition: background-color 200ms ease; }
.nmp-switch i { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--nmp-card); box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform 260ms var(--nmp-ease); }
.nmp-switch[aria-checked="true"] { background: var(--nmp-ember); }
.nmp-switch[aria-checked="true"] i { transform: translateX(12px); }

.nmp-off { margin: 0 16px 8px; padding: 8px 10px; border-radius: 8px; background: rgba(178,106,0,.08); color: var(--nmp-warn-ink); font-size: 12px; line-height: 18px; animation: nmp-in 260ms ease both; }
.nmp-off[hidden] { display: none; }
.nmp-off p { margin: 0; }
.nmp-card[data-off] .nmp-list { opacity: .5; }

.nmp-filters { display: flex; align-items: center; gap: 6px; padding: 0 10px 10px 16px; border-bottom: .5px solid var(--nmp-line); }
.nmp-tabs { display: flex; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; margin: -2px; padding: 2px; }
.nmp-tabs::-webkit-scrollbar { display: none; }
@container (max-width: 400px) { .nmp-tabs { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 18px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 18px), transparent); padding-right: 14px; } .nmp-tab { padding: 0 8px; } }
.nmp-tab { display: inline-flex; align-items: center; gap: 5px; flex: none; height: 28px; padding: 0 9px; border-radius: 6px; box-shadow: inset 0 0 0 .5px rgba(var(--nmp-rgb),.1); font-weight: 500; color: var(--nmp-text); white-space: nowrap; transition: background-color 140ms ease, color 140ms ease; }
.nmp-tab:hover { background: var(--nmp-wash); color: var(--nmp-ink); }
.nmp-tab[aria-selected="true"] { background: var(--nmp-fill); color: var(--nmp-ink); box-shadow: none; }
.nmp-tab small { font-size: 12px; color: var(--grey); font-variant-numeric: tabular-nums; }
.nmp-find { display: grid; place-items: center; width: 28px; height: 28px; margin-left: auto; border-radius: 6px; color: rgba(var(--nmp-rgb), 0.58); flex: none; }
.nmp-find:hover, .nmp-find[aria-expanded="true"] { background: var(--nmp-wash); color: var(--nmp-ink); }
.nmp-find svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.nmp-search { padding: 8px 16px; border-bottom: .5px solid var(--nmp-line); animation: nmp-in 220ms ease both; }
.nmp-search[hidden] { display: none; }
.nmp-q { width: 100%; height: 30px; padding: 0 10px; border: 0; border-radius: 6px; box-shadow: inset 0 0 0 .5px rgba(var(--nmp-rgb),.14); font: inherit; color: var(--nmp-ink); background: var(--nmp-card); }
.nmp-q::placeholder { color: var(--grey); }

.nmp-list { max-height: 360px; overflow-y: auto; padding: 4px 0 6px; scrollbar-width: thin; transition: opacity 200ms ease; }
.nmp-group { margin: 10px 16px 2px; font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--grey); }
.nmp-item { position: relative; display: flex; gap: 8px; padding: 7px 16px 7px 16px; transition: background-color 140ms ease; }
.nmp-item:hover, .nmp-item:focus-within { background: var(--nmp-wash); }
.nmp-item-main { flex: 1; min-width: 0; }
.nmp-text { margin: 0; color: var(--nmp-ink); overflow-wrap: anywhere; }
.nmp-item[data-paused] .nmp-text { color: var(--grey); }
.nmp-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12px; line-height: 16px; color: var(--grey); margin-top: 2px; }
.nmp-meta-dot { width: 2px; height: 2px; border-radius: 50%; background: currentColor; }
.nmp-paused { display: inline-grid; place-items: center; height: 18px; padding: 0 6px; border-radius: 4px; background: rgba(178,106,0,.10); color: var(--nmp-wait); font-weight: 500; }
.nmp-acts { position: absolute; top: 5px; right: 8px; display: flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--nmp-card); box-shadow: 0 0 0 .5px rgba(var(--nmp-rgb),.08), 0 4px 12px -4px rgba(0,0,0,.12); opacity: 0; pointer-events: none; transition: opacity 140ms ease; }
.nmp-item:hover .nmp-acts, .nmp-item:focus-within .nmp-acts { pointer-events: auto; }
.nmp-item:hover .nmp-acts, .nmp-item:focus-within .nmp-acts { opacity: 1; }
.nmp-act { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; color: rgba(var(--nmp-rgb), 0.58); }
.nmp-act:hover { background: var(--nmp-fill); color: var(--nmp-ink); }
.nmp-act--forget:hover { color: var(--nmp-del); background: rgba(196,72,48,.08); }
.nmp-act svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.nmp-edit { width: 100%; min-height: 52px; padding: 6px 8px; border: 0; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(217,96,28,.5), 0 0 0 3px rgba(217,96,28,.1); font: inherit; color: var(--nmp-ink); background: var(--nmp-card); resize: none; }
#c-b-memory-panel .nmp-edit:focus-visible { outline: none; }
.nmp-edit-row { display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px; }
.nmp-empty { padding: 28px 16px; text-align: center; color: var(--grey); }

.nmp-btn { display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: 6px; font-weight: 500; white-space: nowrap; }
.nmp-cancel, .nmp-btn--ghost { box-shadow: var(--nmp-shadow); }
.nmp-cancel:hover, .nmp-btn--ghost:hover { background: var(--nmp-wash); }
.nmp-save, .nmp-btn--solid { background: var(--nmp-solid); color: var(--nmp-on-solid); }
.nmp-save:hover:not(:disabled), .nmp-btn--solid:hover:not(:disabled) { background: rgba(var(--nmp-rgb),.78); }
.nmp-save:disabled, .nmp-btn--solid:disabled { background: var(--nmp-fill); color: var(--grey); cursor: default; }

.nmp-addrow { border-top: .5px solid var(--nmp-line); }
.nmp-add { display: flex; align-items: center; gap: 8px; width: 100%; height: 40px; padding: 0 16px; color: var(--nmp-text); font-weight: 500; transition: background-color 140ms ease, color 140ms ease; }
.nmp-add:hover { background: var(--nmp-wash); color: var(--nmp-ink); }
.nmp-add[hidden] { display: none; }
.nmp-add svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.nmp-new { padding: 12px 14px 12px 16px; animation: nmp-in 220ms ease both; }
.nmp-new[hidden] { display: none; }
.nmp-ta { width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; box-shadow: inset 0 0 0 .5px rgba(var(--nmp-rgb),.14); font: inherit; color: var(--nmp-ink); background: var(--nmp-card); resize: none; }
.nmp-ta::placeholder { color: var(--grey); }
.nmp-new-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.nmp-cats { display: flex; flex-wrap: wrap; gap: 4px; flex: 1 1 100%; margin-bottom: 4px; }
.nmp-new-row .nmp-cancel { margin-left: auto; }
.nmp-cat { height: 26px; padding: 0 8px; border-radius: 6px; box-shadow: inset 0 0 0 .5px rgba(var(--nmp-rgb),.12); font-size: 12px; font-weight: 500; color: var(--nmp-text); }
.nmp-cat[aria-checked="true"] { background: rgba(217,96,28,.10); color: var(--nmp-te-fg); box-shadow: inset 0 0 0 .5px rgba(217,96,28,.4); }

.nmp-foot { padding: 9px 16px 11px; border-top: .5px solid var(--nmp-line); font-size: 12px; line-height: 16px; color: var(--grey); font-variant-numeric: tabular-nums; }
.nmp-foot b { font-weight: 500; color: var(--nmp-ink); }
.nmp-tray { position: absolute; left: 10px; right: 10px; bottom: 8px; display: flex; align-items: center; gap: 8px; padding: 5px 5px 5px 12px; border-radius: 8px; background: var(--nmp-solid); color: var(--nmp-on-solid); font-size: 12px; animation: nmp-up 240ms var(--nmp-ease) both; }
.nmp-tray[hidden] { display: none; }
.nmp-tray-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nmp-tray-undo { height: 24px; padding: 0 8px; border-radius: 5px; font-weight: 500; color: #F4B48A; }
.nmp-tray-undo:hover { background: rgba(255,255,255,.1); }
@keyframes nmp-in { from { opacity: 0; } }
@keyframes nmp-up { from { opacity: 0; transform: translateY(6px); } }
.nmp-item[data-new] { animation: nmp-flash 1.2s ease; }
@keyframes nmp-flash { from { background: rgba(217,96,28,.10); } }

@media (hover: none) { .nmp-acts { position: static; align-self: flex-start; opacity: 1; pointer-events: auto; box-shadow: none; background: none; padding: 0; } }
@media (pointer: coarse) { .nmp-act { width: 34px; height: 34px; } .nmp-tab, .nmp-btn { height: 34px; } }
@media (prefers-reduced-motion: reduce) {
  #c-b-memory-panel *, #c-b-memory-panel *::before, #c-b-memory-panel *::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-memory-panel {
  --nmp-ink: rgba(255,255,255,.9); --nmp-text: rgba(255,255,255,.64);   --nmp-line: rgba(255,255,255,.08); --nmp-wash: rgba(255,255,255,.04); --nmp-fill: rgba(255,255,255,.08);
  --nmp-card: #1C1B1A; --nmp-strong: #fff; --nmp-solid: rgba(255,255,255,.9); --nmp-on-solid: #161615; --nmp-raised: #232220; --nmp-rgb: 255,255,255;
  --nmp-ember-ink: #F08A4B; --nmp-del: #FF8A73; --nmp-warn-ink: #F0B232; --nmp-ok: #3EC27A; --nmp-toast: #2C2B29; --nmp-wait: #F0B232;
  --nmp-te-bg: rgba(217,96,28,.2); --nmp-te-fg: #F5A06C; --nmp-tg-bg: rgba(62,194,122,.15); --nmp-tg-fg: #6FD49C; --nmp-tn-bg: rgba(255,255,255,.1); --nmp-ty-bg: rgba(240,178,50,.15); --nmp-ty-fg: #F0B232;
  --nmp-shadow: 0 0 0 .5px rgba(255,255,255,.1), 0 1px 2px rgba(0,0,0,.4);
  --nmp-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);
}
