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

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

.nth-card { background: var(--nth-card); border-radius: 10px; box-shadow: var(--nth-shadow); }
.nth-head { display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 6px; }
.nth-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; border-radius: 6px; text-align: left; transition: background-color 160ms ease; }
.nth-toggle:hover { background: var(--nth-wash); }
.nth-dots { display: grid; grid-template-columns: repeat(3, 3px); gap: 2px; flex: none; }
.nth-dots i { width: 3px; height: 3px; border-radius: 1px; background: var(--grey); }
.nth-card[data-state="done"] .nth-dots i { background: var(--nth-ok); opacity: .55; }
.nth-card[data-state="run"] .nth-dots i { background: var(--nth-ember); animation: nth-dot 1.2s ease-in-out infinite; }
.nth-card[data-state="run"] .nth-dots i:nth-child(3n+2) { animation-delay: .15s; }
.nth-card[data-state="run"] .nth-dots i:nth-child(3n) { animation-delay: .3s; }
.nth-card[data-state="run"] .nth-dots i:nth-child(n+4) { animation-delay: .45s; }
.nth-card[data-state="run"] .nth-dots i:nth-child(n+7) { animation-delay: .6s; }
@keyframes nth-dot { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
.nth-label { font-weight: 500; color: var(--nth-text); white-space: nowrap; }
.nth-card[data-state="run"] .nth-label { background: linear-gradient(90deg, var(--grey) 0 35%, rgba(var(--nth-rgb),.9) 50%, var(--grey) 65% 100%); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: nth-shine 1.6s linear infinite; }
@keyframes nth-shine { from { background-position: 100% 0; } to { background-position: 0 0; } }
.nth-time { font-size: 12px; color: var(--grey); font-variant-numeric: tabular-nums; }
.nth-chev { width: 16px; height: 16px; margin-left: auto; fill: none; stroke: rgba(var(--nth-rgb), 0.58); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; transition: transform 300ms var(--nth-ease); }
.nth-toggle[aria-expanded="false"] .nth-chev { transform: rotate(-90deg); }
.nth-play { display: inline-flex; align-items: center; gap: 6px; flex: none; height: 28px; padding: 0 10px 0 8px; border-radius: 6px; box-shadow: var(--nth-shadow); font-size: 12px; font-weight: 500; transition: background-color 160ms ease, opacity 160ms ease; }
.nth-play:hover:not(:disabled) { background: var(--nth-wash); }
.nth-play:disabled { opacity: .4; cursor: default; }
.nth-play svg { width: 14px; height: 14px; fill: currentColor; }

.nth-fold { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 420ms var(--nth-ease); border-top: .5px solid transparent; }
.nth-fold[data-open] { grid-template-rows: 1fr; border-top-color: var(--nth-line); }
.nth-clip { min-height: 0; overflow: hidden; }
.nth-steps { list-style: none; margin: 0; padding: 12px 14px 14px; display: grid; }
.nth-step { position: relative; display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; padding-bottom: 12px; animation: nth-in 380ms var(--nth-ease) both; }
.nth-step:last-child { padding-bottom: 0; }
.nth-step[hidden] { display: none; }
.nth-step:not(:last-child)::before { content: ""; position: absolute; left: 9.5px; top: 22px; bottom: 2px; width: 1px; background: rgba(var(--nth-rgb),.08); }
.nth-ico { display: grid; place-items: center; width: 20px; height: 20px; color: rgba(var(--nth-rgb), 0.58); }
.nth-ico svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.nth-step--done .nth-ico { color: var(--nth-ok); }
.nth-step--done .nth-ico svg { stroke-width: 1.6; }
.nth-step[data-now] .nth-ico { color: var(--nth-ember-ink); }
.nth-main { min-width: 0; display: grid; gap: 2px; }
.nth-title { color: var(--nth-text); }
.nth-step[data-now] .nth-title { color: var(--nth-ink); }
.nth-final { color: var(--nth-ok); font-weight: 500; }
.nth-sub { font-size: 12px; line-height: 18px; color: var(--grey); }
.nth-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.nth-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px; border-radius: 6px; box-shadow: inset 0 0 0 .5px rgba(var(--nth-rgb),.12); font-size: 12px; line-height: 16px; color: var(--nth-ink); white-space: nowrap; animation: nth-in 320ms var(--nth-ease) both; }
.nth-chip[hidden] { display: none; }
.nth-chip i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.nth-chip i[data-k="doc"] { background: #F2C9AE; }
.nth-chip i[data-k="cal"] { background: #BFDCCB; }
.nth-chip i[data-k="key"] { background: rgba(var(--nth-rgb),.18); }
.nth-chip i[data-k="phone"] { background: #E8B48F; }
.nth-chip i[data-k="mail"] { background: #D7D3CC; }
.nth-more { height: 26px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 500; color: var(--grey); transition: background-color 140ms ease, color 140ms ease; }
.nth-more:hover { background: var(--nth-fill); color: var(--nth-ink); }
.nth-more[hidden] { display: none; }
@keyframes nth-in { from { opacity: 0; transform: translateY(4px); filter: blur(2px); } }

@media (pointer: coarse) { .nth-play { height: 34px; } .nth-more { height: 32px; } }
@media (prefers-reduced-motion: reduce) {
  #c-b-thinking-state *, #c-b-thinking-state *::before, #c-b-thinking-state *::after { animation: none !important; transition: none !important; }
  .nth-card[data-state="run"] .nth-label { color: var(--nth-text); background: none; }
}

/* 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-thinking-state {
  --nth-ink: rgba(255,255,255,.9); --nth-text: rgba(255,255,255,.64);   --nth-line: rgba(255,255,255,.08); --nth-wash: rgba(255,255,255,.04); --nth-fill: rgba(255,255,255,.08);
  --nth-card: #1C1B1A; --nth-strong: #fff; --nth-solid: rgba(255,255,255,.9); --nth-on-solid: #161615; --nth-raised: #232220; --nth-rgb: 255,255,255;
  --nth-ember-ink: #F08A4B; --nth-del: #FF8A73; --nth-warn-ink: #F0B232; --nth-ok: #3EC27A; --nth-toast: #2C2B29; --nth-wait: #F0B232;
  --nth-te-bg: rgba(217,96,28,.2); --nth-te-fg: #F5A06C; --nth-tg-bg: rgba(62,194,122,.15); --nth-tg-fg: #6FD49C; --nth-tn-bg: rgba(255,255,255,.1); --nth-ty-bg: rgba(240,178,50,.15); --nth-ty-fg: #F0B232;
  --nth-shadow: 0 0 0 .5px rgba(255,255,255,.1), 0 1px 2px rgba(0,0,0,.4);
  --nth-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-thinking-state .nth-chip i[data-k="doc"] { background: #B9693A; }
:where(.dark, [data-theme="dark"]) #c-b-thinking-state .nth-chip i[data-k="cal"] { background: #3E9468; }
:where(.dark, [data-theme="dark"]) #c-b-thinking-state .nth-chip i[data-k="phone"] { background: #D9601C; }
:where(.dark, [data-theme="dark"]) #c-b-thinking-state .nth-chip i[data-k="mail"] { background: rgba(255,255,255,.3); }
