/* Egen kod, idé från affectUI Context Window (Pro), ingen kod tagen */
#c-b-context-window {
  --ncw-ink: rgba(0,0,0,.88); --ncw-text: rgba(0,0,0,.61);   --ncw-line: rgba(0,0,0,.06); --ncw-wash: rgba(0,0,0,.03); --ncw-fill: rgba(0,0,0,.06);
  --ncw-ember: #D9601C; --ncw-ok: #1E7A4C; --ncw-wait: #8A5200;
  --ncw-c0: #8E3A0F; --ncw-c1: #D9601C; --ncw-c2: #F2A774; --ncw-c3: #CFC8BE; --ncw-c4: #57534E; --ncw-free: rgba(0,0,0,.07);
  --ncw-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);
  --ncw-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(--ncw-ink); -webkit-font-smoothing: antialiased;
  --ncw-card: #fff; --ncw-strong: #000; --ncw-solid: rgba(0,0,0,.88); --ncw-on-solid: #fcfcfc; --ncw-raised: #FBFAF8; --ncw-rgb: 0,0,0;
  --ncw-ember-ink: #B4501A; --ncw-del: #A3402C; --ncw-warn-ink: #7A4B05; --ncw-toast: rgba(0,0,0,.86);
  --ncw-te-bg: #F7E3D6; --ncw-te-fg: #9A4310; --ncw-tg-bg: #DDEDE4; --ncw-tg-fg: #1E6A44; --ncw-tn-bg: #ECEBE8; --ncw-ty-bg: #F3E6C9; --ncw-ty-fg: #7A5410;
}

#c-b-context-window *, #c-b-context-window *::before, #c-b-context-window *::after { box-sizing: border-box; }
:where(#c-b-context-window) 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-context-window button:focus-visible { outline: 2px solid rgba(217,96,28,.4); outline-offset: 1px; }
#c-b-context-window svg { display: block; flex: none; }
.ncw-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.ncw-card { background: var(--ncw-card); border-radius: 10px; box-shadow: var(--ncw-shadow); }
.ncw-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 0 16px; }
.ncw-title { margin: 0; font-size: 13px; line-height: 20px; font-weight: 600; color: var(--ncw-strong); }
.ncw-model { display: inline-flex; align-items: center; gap: 5px; height: 22px; margin-left: auto; padding: 0 7px; border-radius: 5px; background: var(--ncw-wash); box-shadow: inset 0 0 0 .5px rgba(var(--ncw-rgb),.08); font-size: 12px; color: var(--ncw-text); white-space: nowrap; }
.ncw-model svg { width: 11px; height: 11px; fill: none; stroke: var(--ncw-ember); stroke-width: 1.5; stroke-linecap: round; }

.ncw-total { display: flex; align-items: baseline; gap: 6px; padding: 8px 14px 0 16px; }
.ncw-big { font-size: 24px; line-height: 30px; font-weight: 500; letter-spacing: -.02em; color: var(--ncw-strong); font-variant-numeric: tabular-nums; }
.ncw-of { font-size: 12px; color: var(--grey); white-space: nowrap; }
.ncw-pct { align-self: center; margin-left: auto; height: 20px; padding: 0 6px; border-radius: 5px; font-size: 12px; line-height: 20px; font-weight: 500; font-variant-numeric: tabular-nums; background: var(--ncw-fill); color: var(--ncw-text); transition: background-color 300ms ease, color 300ms ease; }
.ncw-pct[data-level="high"] { background: rgba(178,106,0,.12); color: var(--ncw-wait); }

/* Fältet: 200 rutor, en per 1 000 token */
.ncw-field { display: grid; grid-template-columns: repeat(25, minmax(0, 1fr)); gap: 2px; padding: 12px 16px 14px; }
.ncw-cell { aspect-ratio: 1; border-radius: 2px; background: var(--ncw-free); transition: background-color 420ms ease, opacity 220ms ease, transform 220ms var(--ncw-ease); }
.ncw-cell[data-k="0"] { background: var(--ncw-c0); }
.ncw-cell[data-k="1"] { background: var(--ncw-c1); }
.ncw-cell[data-k="2"] { background: var(--ncw-c2); }
.ncw-cell[data-k="3"] { background: var(--ncw-c3); }
.ncw-cell[data-k="4"] { background: var(--ncw-c4); }
.ncw-field[data-hot] .ncw-cell { opacity: .22; }
.ncw-field[data-hot] .ncw-cell[data-on] { opacity: 1; transform: scale(1.08); }
.ncw-cell[data-shim] { animation: ncw-shim 900ms ease-in-out both; }
@keyframes ncw-shim { 0% { opacity: 1; } 40% { opacity: .35; transform: scale(.7); } 100% { opacity: 1; } }

.ncw-legend { list-style: none; margin: 0; padding: 0 0 6px; border-top: .5px solid var(--ncw-line); }
.ncw-row { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px 0 16px; transition: background-color 140ms ease; }
.ncw-row:hover, .ncw-row:focus-within { background: var(--ncw-wash); }
.ncw-sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.ncw-name { display: inline-flex; align-items: center; gap: 4px; min-width: 0; color: var(--ncw-ink); }
.ncw-name-btn { display: inline-flex; align-items: center; gap: 4px; height: 28px; margin: 0 -4px; padding: 0 4px; border-radius: 5px; }
.ncw-name-btn:hover { background: var(--ncw-fill); }
.ncw-name-btn svg { width: 14px; height: 14px; fill: none; stroke: rgba(var(--ncw-rgb), 0.58); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; transition: transform 300ms var(--ncw-ease); }
.ncw-name-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.ncw-val { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--ncw-text); white-space: nowrap; }
.ncw-compact { display: inline-flex; align-items: center; gap: 5px; height: 26px; margin-left: auto; padding: 0 7px; border-radius: 6px; font-size: 12px; font-weight: 500; color: var(--ncw-text); white-space: nowrap; transition: background-color 140ms ease, color 140ms ease, transform 140ms var(--ncw-ease); }
.ncw-compact:active:not(:disabled) { transform: scale(.97); }
.ncw-compact:hover:not(:disabled) { background: var(--ncw-fill); color: var(--ncw-ink); }
.ncw-compact:disabled { cursor: default; opacity: .55; box-shadow: none; }
.ncw-compact svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.ncw-compact + .ncw-val { margin-left: 6px; }
.ncw-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@container (max-width: 300px) { .ncw-compact { font-size: 0; gap: 0; width: 26px; justify-content: center; padding: 0; } .ncw-compact svg { width: 14px; height: 14px; } }
.ncw-files { list-style: none; margin: 0 0 4px; padding: 0 14px 0 34px; display: grid; animation: ncw-in 260ms ease both; }
.ncw-files[hidden] { display: none; }
.ncw-file { display: flex; align-items: center; gap: 8px; min-height: 30px; font-size: 12px; color: var(--ncw-text); }
.ncw-file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 12px; }
.ncw-file .ncw-val { font-size: 12px; }
.ncw-x { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; color: rgba(var(--ncw-rgb), 0.58); flex: none; }
.ncw-x:hover { background: rgba(196,72,48,.08); color: var(--ncw-del); }
.ncw-x svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.ncw-nofiles { font-size: 12px; color: var(--grey); min-height: 30px; display: flex; align-items: center; }
@keyframes ncw-in { from { opacity: 0; transform: translateY(-3px); } }

.ncw-foot { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 16px; border-top: .5px solid var(--ncw-line); }
.ncw-left { font-size: 12px; font-weight: 500; color: var(--ncw-ok); font-variant-numeric: tabular-nums; }
.ncw-left[data-level="high"] { color: var(--ncw-wait); }
.ncw-new { display: inline-flex; align-items: center; gap: 6px; height: 28px; margin-left: auto; padding: 0 10px; border-radius: 6px; box-shadow: var(--ncw-shadow); font-weight: 500; }
.ncw-new:hover { background: var(--ncw-wash); }
.ncw-new svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

@media (pointer: coarse) { .ncw-x { width: 32px; height: 32px; } .ncw-compact, .ncw-new { height: 34px; } }
@media (prefers-reduced-motion: reduce) {
  #c-b-context-window *, #c-b-context-window *::before, #c-b-context-window *::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-context-window {
  --ncw-ink: rgba(255,255,255,.9); --ncw-text: rgba(255,255,255,.64);   --ncw-line: rgba(255,255,255,.08); --ncw-wash: rgba(255,255,255,.04); --ncw-fill: rgba(255,255,255,.08);
  --ncw-card: #1C1B1A; --ncw-strong: #fff; --ncw-solid: rgba(255,255,255,.9); --ncw-on-solid: #161615; --ncw-raised: #232220; --ncw-rgb: 255,255,255;
  --ncw-ember-ink: #F08A4B; --ncw-del: #FF8A73; --ncw-warn-ink: #F0B232; --ncw-ok: #3EC27A; --ncw-toast: #2C2B29; --ncw-wait: #F0B232;
  --ncw-te-bg: rgba(217,96,28,.2); --ncw-te-fg: #F5A06C; --ncw-tg-bg: rgba(62,194,122,.15); --ncw-tg-fg: #6FD49C; --ncw-tn-bg: rgba(255,255,255,.1); --ncw-ty-bg: rgba(240,178,50,.15); --ncw-ty-fg: #F0B232;
  --ncw-shadow: 0 0 0 .5px rgba(255,255,255,.1), 0 1px 2px rgba(0,0,0,.4);
  --ncw-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);
}
:where(.dark, [data-theme="dark"]) #c-b-context-window { --ncw-c0: #F5B48A; --ncw-c1: #D9601C; --ncw-c2: #9C4A1C; --ncw-c3: #5A5754; --ncw-c4: #A8A29C; --ncw-free: rgba(255,255,255,.07); }
