/*
 * wb-kit.css: the shared parts of the redesigned panel pages (prefix .wk-).
 * Modelled on the QR dashboard (assets/tools/qr-dash.css); panel tokens only,
 * so wallpapers, the accent colour and dark mode come for free.
 * Load it with wb_asset('assets/wb-kit.css') from the page that uses it,
 * together with assets/wb-kit.js when the page has a drawer or a segmented control.
 *
 *   .wk-kpis                       KPI strip: an optional .wk-kpi--hero (the
 *                                  double-bezel lead card, > .wk-bezel__core),
 *                                  then .wk-kpis__rest holding the .wk-kpi stats.
 *                                  Parts: __label __ico __val __sub __foot,
 *                                  tones --ok --warn --bad, .wk-delta(--up/--down)
 *   .wk-spark                      inline SVG sparkline (wk_spark() in app/kit.php,
 *                                  WK.spark() in wb-kit.js draw the same markup)
 *   .wk-cards > .wk-card           card grid; .wk-card__ico, strong, span
 *   .wk-panel, .wk-panel__head     a section card with its heading row
 *   .wk-list > .wk-row             rows with an icon, text, meta and a call to action;
 *                                  tones --ok --warn --bad; .wk-list--quiet for hairline rows
 *   dialog.wk-drawer               side drawer: .wk-drawer__head, .wk-drawer__body
 *   .wk-seg                        segmented control (buttons with aria-pressed)
 *   .wk-empty                      designed empty state (icon, h3, p, actions)
 *   .wk-skel                       skeleton; --line --kpi --row --block, shimmers once
 *   .wk-cta > .wk-cta__ico         accent pill with the icon in its own circle
 *   .wk-sr                         visually hidden text
 *
 *   Studio pages (a tool that fills the window: 'focus' => true in wb_shell_start):
 *   .wk-studio                     the frame; > .wk-studio__bar (glass top bar with
 *                                  .wk-studio__menu [data-wb-nav-toggle], .wk-studio__back,
 *                                  .wk-studio__title, .wk-studio__acts), then
 *                                  .wk-studio__body > .wk-studio__panel + .wk-studio__canvas
 *   .wk-ring                       score ring, style="--v:82", tones --ok --warn --bad
 *   .wk-progress > i               progress bar (set the width of the <i>)
 *   .wk-compare                    before/after slider: img, .wk-compare__after > img,
 *                                  .wk-compare__line > .wk-compare__knob, and an
 *                                  input[type=range][data-wk-compare] (wb-kit.js)
 *   .wk-bar                        a thin score bar, style="--v:64"
 *   .wk-nav                        a studio's left menu: .wk-nav__group labels and
 *                                  .wk-nav__item links (.is-on / aria-current="page")
 */

.wk-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

:is(.wk-kpis, .wk-cards, .wk-panel, .wk-drawer, .wk-seg, .wk-empty) :is(a, button, input, select, [tabindex]):focus-visible,
:is(.wk-kpi, .wk-card, .wk-row, .wk-cta):focus-visible {
  outline: 2px solid var(--wb-accent);
  outline-offset: 3px;
}

/* ---- primary call to action: accent pill, icon nested in a circle ---------- */
.wk-cta {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 6px 6px 6px 18px;
  border: 0;
  border-radius: var(--wb-r-pill);
  background: var(--wb-accent);
  color: var(--wb-accent-contrast);
  box-shadow: var(--wb-shadow-sm);
  font: inherit;
  font-size: .86rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 160ms var(--wb-ease), box-shadow 180ms var(--wb-ease);
}
.wk-cta:hover { box-shadow: var(--wb-shadow); }
.wk-cta:active { transform: scale(.97); }
.wk-cta__ico {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--wb-accent-contrast) 18%, transparent);
}
.wk-cta__ico svg { width: 16px; height: 16px; }

/* ---- double bezel (hero surfaces only) ------------------------------------- */
.wk-bezel {
  padding: 6px;
  border: 1px solid var(--wb-border);
  border-radius: var(--wb-r-lg);
  background: var(--wb-surface-sunk);
}
.wk-bezel__core {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-radius: calc(var(--wb-r-lg) - 6px);
  background: var(--wb-surface-solid);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
}

/* ---- KPI strip ------------------------------------------------------------- */
.wk-kpis {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 14px;
  font-variant-numeric: tabular-nums;
}
/* The stats beside the hero: two columns; an odd one out takes the full row. */
.wk-kpis__rest { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; min-width: 0; }
.wk-kpis__rest:only-child { grid-column: 1 / -1; grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); }
.wk-kpi--hero + .wk-kpis__rest > .wk-kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
.wk-kpi {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--wb-border);
  border-radius: var(--wb-r-lg);
  background: var(--wb-surface-solid);
  box-shadow: var(--wb-shadow-sm);
  color: var(--wb-text);
  text-decoration: none;
  transition: transform 180ms var(--wb-ease), border-color 180ms var(--wb-ease);
}
a.wk-kpi:hover { transform: translateY(-2px); border-color: var(--wb-border-strong); }
a.wk-kpi:active { transform: scale(.98); }
.wk-kpi--hero {
  padding: 6px;
  background: var(--wb-surface-sunk);
  box-shadow: none;
}
.wk-kpi--hero > .wk-bezel__core { padding: 20px 22px 18px; }
.wk-kpi__label {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--wb-text-soft);
  font-size: .84rem;
  font-weight: 600;
  line-height: 1.3;
}
.wk-kpi__ico {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: var(--wb-r-sm);
  background: var(--wb-surface-sunk);
  color: var(--wb-accent);
}
.wk-kpi__ico svg { width: 16px; height: 16px; }
.wk-kpi__val {
  display: block;
  margin: 14px 0 6px;
  font-family: 'Bricolage Grotesque', 'Geist', system-ui, sans-serif;
  font-size: clamp(1.7rem, 2.6vw, 2.3rem);
  font-weight: 650;
  line-height: 1.05;
  letter-spacing: -.04em;
  overflow-wrap: anywhere;
}
.wk-kpi__val--word { font-size: clamp(1.15rem, 1.7vw, 1.4rem); letter-spacing: -.02em; }
.wk-kpi--hero .wk-kpi__val { margin: 16px 0 8px; font-size: clamp(2.8rem, 4.6vw, 4.2rem); letter-spacing: -.06em; }
.wk-kpi__sub { display: block; color: var(--wb-muted); font-size: .8rem; line-height: 1.5; }
.wk-kpi__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
  color: var(--wb-text-soft);
  font-size: .8rem;
  font-weight: 600;
}
.wk-kpi__foot > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-kpi__foot svg { flex-shrink: 0; transition: transform 180ms var(--wb-ease); }
a.wk-kpi:hover .wk-kpi__foot svg { transform: translateX(3px); }
.wk-kpi__row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.wk-kpi__row .wk-spark { margin-bottom: 10px; }
.wk-kpi--ok .wk-kpi__ico { background: var(--wb-ok-bg); color: var(--wb-ok); }
.wk-kpi--warn .wk-kpi__ico { background: var(--wb-warn-bg); color: var(--wb-warn); }
.wk-kpi--warn .wk-kpi__val { color: var(--wb-warn); }
.wk-kpi--bad .wk-kpi__ico { background: var(--wb-bad-bg); color: var(--wb-bad); }
.wk-kpi--bad .wk-kpi__val { color: var(--wb-bad); }
.wk-delta { display: inline-flex; align-items: center; gap: 4px; color: var(--wb-muted); font-size: .76rem; font-weight: 600; }
.wk-delta--up { color: var(--wb-ok); }
.wk-delta--down { color: var(--wb-bad); }

/* Small status chips inside a hero (one per site, for example). */
.wk-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; padding: 0; list-style: none; }
.wk-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 5px 10px;
  border-radius: var(--wb-r-pill);
  background: var(--wb-surface-sunk);
  color: var(--wb-text-soft);
  font-size: .76rem;
  font-weight: 500;
}
.wk-chip > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-dot { width: 7px; height: 7px; flex-shrink: 0; border-radius: 50%; background: var(--wb-muted); }
.wk-dot--ok { background: var(--wb-ok); }
.wk-dot--warn { background: var(--wb-warn); }
.wk-dot--bad { background: var(--wb-bad); }

/* ---- sparkline ------------------------------------------------------------- */
.wk-spark { display: block; flex-shrink: 0; width: 84px; height: 28px; overflow: visible; }
.wk-spark path { fill: none; stroke: var(--wb-accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.wk-spark .wk-spark__fill { fill: var(--wb-accent); stroke: none; opacity: .12; }

/* ---- section card ---------------------------------------------------------- */
.wk-panel {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--wb-border);
  border-radius: var(--wb-r-lg);
  background: var(--wb-surface-solid);
  box-shadow: var(--wb-shadow-sm);
}
.wk-panel__head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.wk-panel__head h2 {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 auto 0 0;
  font-family: 'Bricolage Grotesque', 'Geist', system-ui, sans-serif;
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -.025em;
}
.wk-panel__head .wb-badge { font-family: 'Geist', system-ui, sans-serif; letter-spacing: normal; }
.wk-head-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 0;
  border-radius: var(--wb-r-pill);
  background: transparent;
  color: var(--wb-text-soft);
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.wk-head-link:hover { background: var(--wb-surface-sunk); color: var(--wb-text); }

/* ---- rows ------------------------------------------------------------------ */
.wk-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.wk-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--wb-border);
  border-radius: var(--wb-r);
  background: var(--wb-surface-solid);
  color: var(--wb-text);
  text-decoration: none;
  transition: border-color 160ms var(--wb-ease), background-color 160ms var(--wb-ease);
}
a.wk-row:hover { border-color: var(--wb-border-strong); background: var(--wb-surface-sunk); }
a.wk-row:active { transform: scale(.99); }
.wk-row__ico {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: var(--wb-r-sm);
  background: var(--wb-surface-sunk);
  color: var(--wb-accent);
}
.wk-row__ico svg { width: 18px; height: 18px; }
.wk-row__txt { display: grid; flex: 1; min-width: 0; gap: 2px; }
.wk-row__txt > strong { font-size: .92rem; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.wk-row__txt > span { color: var(--wb-muted); font-size: .78rem; line-height: 1.45; overflow-wrap: anywhere; }
.wk-row__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  color: var(--wb-accent);
  font-size: .84rem;
  font-weight: 650;
  white-space: nowrap;
}
.wk-row__cta svg { transition: transform 180ms var(--wb-ease); }
a.wk-row:hover .wk-row__cta svg { transform: translateX(3px); }
.wk-row--warn .wk-row__ico { background: var(--wb-warn-bg); color: var(--wb-warn); }
.wk-row--bad .wk-row__ico { background: var(--wb-bad-bg); color: var(--wb-bad); }
.wk-row--bad { border-color: color-mix(in srgb, var(--wb-bad) 28%, var(--wb-border)); }
.wk-row--ok .wk-row__ico { background: var(--wb-ok-bg); color: var(--wb-ok); }

/* Quiet rows: hairlines instead of boxes, for prompts that should stay in the background. */
.wk-list--quiet { gap: 0; }
.wk-list--quiet > li + li { border-top: 1px solid var(--wb-border); }
.wk-list--quiet .wk-row { align-items: flex-start; padding: 12px 2px; border: 0; border-radius: 0; background: transparent; }
.wk-list--quiet a.wk-row:hover { background: transparent; }
.wk-list--quiet a.wk-row:hover .wk-row__txt > strong { color: var(--wb-accent); }
.wk-list--quiet .wk-row__ico { width: 28px; height: 28px; background: transparent; color: var(--wb-text-soft); }
.wk-list--quiet .wk-row__txt > strong { font-size: .86rem; }
.wk-list--quiet .wk-row__txt > span { font-size: .76rem; }
.wk-list--quiet .wk-row__cta { padding-top: 4px; color: var(--wb-muted); }

/* ---- card grid ------------------------------------------------------------- */
.wk-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.wk-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--wb-border);
  border-radius: var(--wb-r);
  background: var(--wb-surface-solid);
  color: var(--wb-text);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: transform 180ms var(--wb-ease), border-color 180ms var(--wb-ease);
}
.wk-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--wb-accent) 45%, var(--wb-border)); }
.wk-card:active { transform: scale(.97); }
.wk-card__ico {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: 8px;
  border-radius: var(--wb-r-sm);
  background: var(--wb-surface-sunk);
  color: var(--wb-accent);
}
.wk-card__ico svg { width: 18px; height: 18px; }
.wk-card > strong { font-size: .9rem; font-weight: 600; line-height: 1.35; }
.wk-card > span:last-child:not(.wk-card__ico) { color: var(--wb-muted); font-size: .76rem; line-height: 1.45; }
.wk-card--warn .wk-card__ico { background: var(--wb-warn-bg); color: var(--wb-warn); }

/* ---- segmented control ----------------------------------------------------- */
.wk-seg {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--wb-border);
  border-radius: var(--wb-r-pill);
  background: var(--wb-surface-sunk);
}
.wk-seg > button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 6px 12px;
  border: 0;
  border-radius: var(--wb-r-pill);
  background: transparent;
  color: var(--wb-muted);
  font: inherit;
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.wk-seg > button:hover { color: var(--wb-text); }
.wk-seg > button[aria-pressed="true"] { background: var(--wb-surface-solid); color: var(--wb-text); box-shadow: var(--wb-shadow-sm); }

/* ---- empty state ----------------------------------------------------------- */
.wk-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 28px 20px;
  border: 1px dashed var(--wb-border-strong);
  border-radius: var(--wb-r);
  text-align: center;
}
.wk-empty__ico {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: var(--wb-surface-sunk);
  color: var(--wb-accent);
}
.wk-empty--ok .wk-empty__ico { background: var(--wb-ok-bg); color: var(--wb-ok); }
.wk-empty h3 { margin: 0; font-size: 1rem; font-weight: 650; }
.wk-empty p { max-width: 420px; margin: 0; color: var(--wb-text-soft); font-size: .88rem; line-height: 1.55; }
.wk-empty__acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }

/* ---- skeleton -------------------------------------------------------------- */
.wk-skel {
  position: relative;
  display: block;
  overflow: hidden;
  min-height: 14px;
  border-radius: var(--wb-r-sm);
  background: var(--wb-surface-sunk);
}
.wk-skel::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, var(--wb-surface), transparent);
  animation: wk-shimmer 280ms var(--wb-ease) 1;
}
.wk-skel--line { width: 60%; height: 12px; min-height: 0; margin: 6px 0; }
.wk-skel--kpi { min-height: 132px; border-radius: var(--wb-r-lg); }
.wk-skel--row { min-height: 60px; border-radius: var(--wb-r); }
.wk-skel--block { min-height: 220px; border-radius: var(--wb-r-lg); }

/* ---- side drawer ----------------------------------------------------------- */
.wk-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: 460px;
  max-width: 100%;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0 0 0 auto;
  padding: 0 22px calc(26px + env(safe-area-inset-bottom));
  border: 0;
  border-left: 1px solid var(--wb-border);
  border-radius: 0;
  background: var(--wb-surface-solid);
  color: var(--wb-text);
  box-shadow: var(--wb-shadow-lg);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.wk-drawer::backdrop { background: color-mix(in srgb, var(--wb-text) 30%, transparent); }
.wk-drawer[open] { animation: wk-drawer-in 220ms var(--wb-ease); }
.wk-drawer.is-closing { animation: wk-drawer-out 160ms var(--wb-ease) forwards; }
.wk-drawer__head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 0 16px;
  background: var(--wb-surface-solid);
}
.wk-drawer__head h2 {
  margin: 0;
  font-family: 'Bricolage Grotesque', 'Geist', system-ui, sans-serif;
  font-size: 1.25rem;
  font-weight: 650;
  letter-spacing: -.03em;
  overflow-wrap: anywhere;
}
.wk-drawer__x {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border: 1px solid var(--wb-border);
  border-radius: 50%;
  background: var(--wb-surface-solid);
  color: var(--wb-text-soft);
  cursor: pointer;
}
.wk-drawer__x:hover { background: var(--wb-surface-sunk); color: var(--wb-text); }
.wk-drawer__x:active { transform: scale(.95); }
.wk-drawer__body { display: grid; gap: 16px; }
html:has(.wk-drawer[open]) { overflow: hidden; }
/* The panel's remembered page copies (#wb-preview in wb.js) are still pictures. */
#wb-preview .wk-drawer { display: none !important; }

@keyframes wk-shimmer { to { transform: translateX(100%); } }
@keyframes wk-drawer-in { from { opacity: .6; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
@keyframes wk-drawer-out { to { opacity: 0; transform: translateX(24px); } }

@media (max-width: 900px) {
  .wk-kpis { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 599px) {
  .wk-kpis, .wk-kpis__rest { gap: 10px; }
  .wk-kpis__rest:only-child { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wk-kpi { padding: 14px; }
  .wk-kpi--hero { padding: 5px; }
  .wk-kpi--hero > .wk-bezel__core { padding: 16px; }
  .wk-kpi__label { font-size: .78rem; gap: 7px; }
  .wk-kpi__ico { width: 26px; height: 26px; }
  .wk-kpi__val { margin: 10px 0 4px; font-size: 1.55rem; }
  .wk-kpi__val--word { font-size: 1.02rem; }
  .wk-kpi--hero .wk-kpi__val { font-size: 2.8rem; }
  .wk-kpi__foot { padding-top: 10px; font-size: .76rem; }
  .wk-kpi__row { flex-wrap: wrap; gap: 4px; }
  .wk-kpi__row .wk-spark { width: 64px; margin-bottom: 0; }
  .wk-panel { padding: 16px; }
  .wk-row { padding: 10px; gap: 10px; }
  .wk-row__ico { width: 32px; height: 32px; }
  .wk-row__cta > span { display: none; }
  .wk-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wk-drawer { width: 100%; padding-inline: 16px; border-left: 0; }
  .wk-seg { display: flex; }
  .wk-seg > button { flex: 1; padding-inline: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .wk-cta, .wk-kpi, .wk-row, .wk-card, .wk-drawer, .wk-drawer__x, .wk-kpi__foot svg, .wk-row__cta svg { transition: none !important; }
  .wk-drawer[open], .wk-drawer.is-closing, .wk-skel::after { animation: none !important; }
  .wk-cta:active, a.wk-kpi:hover, a.wk-kpi:active, a.wk-row:active, .wk-card:hover, .wk-card:active, .wk-drawer__x:active,
  a.wk-kpi:hover .wk-kpi__foot svg, a.wk-row:hover .wk-row__cta svg { transform: none !important; }
}

/* ==========================================================================
   Studio pages: one tool fills the window (QR Studio is the model)
   ========================================================================== */
.wk-studio {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--wb-border);
  border-radius: var(--wb-r-lg);
  background: var(--wb-surface-solid);
  color: var(--wb-text);
  box-shadow: var(--wb-shadow);
  isolation: isolate;
}
.wk-studio *, .wk-studio *::before, .wk-studio *::after { box-sizing: border-box; }
.wk-studio :is(button, a, input, select, textarea, summary, [tabindex]):focus-visible { outline: 2px solid var(--wb-accent); outline-offset: 3px; }
.wk-studio__bar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
  min-height: 58px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--wb-border);
  border-radius: var(--wb-r-lg) var(--wb-r-lg) 0 0;
  background: var(--wb-surface);
  -webkit-backdrop-filter: blur(var(--wb-blur));
  backdrop-filter: blur(var(--wb-blur));
}
.wk-studio__menu {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  gap: 7px;
  height: 36px;
  padding: 0 10px 0 6px;
  border: 1px solid var(--wb-border);
  border-radius: var(--wb-r-pill);
  background: var(--wb-surface-solid);
  color: var(--wb-text-soft);
  cursor: pointer;
  transition: background-color 160ms var(--wb-ease), transform 160ms var(--wb-ease);
}
.wk-studio__menu:hover, .wk-studio__menu[aria-expanded="true"] { background: var(--wb-surface-sunk); border-color: var(--wb-border-strong); }
.wk-studio__menu:active { transform: scale(.97); }
.wk-studio__menu img { display: block; width: 24px; height: 24px; border-radius: 7px; }
.wk-studio__menu svg { width: 16px; height: 16px; }
.wk-studio__back {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  gap: 4px;
  height: 36px;
  padding: 0 12px 0 8px;
  border-radius: var(--wb-r-pill);
  color: var(--wb-text-soft);
  font-size: .82rem;
  font-weight: 600;
  text-decoration: none;
}
.wk-studio__back:hover { background: var(--wb-surface-sunk); color: var(--wb-text); }
.wk-studio__title { min-width: 0; margin-right: auto; padding-left: 12px; border-left: 1px solid var(--wb-border); }
.wk-studio__name > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.wk-studio__title .wk-studio__name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: 0;
  font-family: 'Bricolage Grotesque', 'Geist', system-ui, sans-serif;
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.03em;
}
.wk-studio__tag { margin: 3px 0 0; color: var(--wb-muted); font-size: .74rem; line-height: 1.4; }
.wk-studio__acts { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.wk-studio__acts .wb-badge { padding: 7px 10px; font-size: .7rem; letter-spacing: 0; text-transform: none; }
.wk-studio__body { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); flex: 1 1 auto; min-height: 620px; }
.wk-studio__panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  padding: 20px;
  overflow: auto;
  border-right: 1px solid var(--wb-border);
  border-radius: 0 0 0 var(--wb-r-lg);
  background: var(--wb-surface-solid);
  scrollbar-width: thin;
  scrollbar-color: var(--wb-border-strong) transparent;
}
.wk-studio__canvas {
  position: relative;
  min-width: 0;
  padding: 24px;
  overflow: auto;
  border-radius: 0 0 var(--wb-r-lg) 0;
  background-color: var(--wb-surface-sunk);
  background-image: radial-gradient(var(--wb-border-strong) .7px, transparent .7px);
  background-size: 18px 18px;
  scrollbar-width: thin;
  scrollbar-color: var(--wb-border-strong) transparent;
}
/* One column of content on the canvas, readable width. */
.wk-studio__col { display: flex; flex-direction: column; gap: 16px; width: 100%; max-width: 920px; margin: 0 auto; }
.wk-studio__h { margin: 0 0 10px; color: var(--wb-text-soft); font-size: .78rem; font-weight: 650; }
.wk-studio__panel .wb-help__panel { margin: 0; }

/* In focus mode the studio takes the window and only its panes scroll. */
@media (min-width: 900px) {
  :root[data-focus] .wk-studio { height: calc(100dvh - var(--wb-focus-gap, 14px) * 2); }
  :root[data-focus] .wk-studio__body { min-height: 0; }
}

/* ---- a studio's left menu (sections of one area, e.g. Finanse) ------------- */
.wk-nav { display: grid; gap: 2px; }
.wk-nav__group { margin: 14px 12px 4px; color: var(--wb-muted); font-size: .72rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.wk-nav__group:first-child { margin-top: 0; }
.wk-nav__item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: var(--wb-r-sm);
  color: var(--wb-text-soft);
  font-size: .93rem;
  font-weight: 500;
  text-decoration: none;
}
.wk-nav__item svg { flex-shrink: 0; color: var(--wb-muted); }
.wk-nav__item:hover { background: var(--wb-surface-sunk); color: var(--wb-text); }
.wk-nav__item.is-on { border-color: color-mix(in srgb, var(--wb-accent) 22%, transparent); background: color-mix(in srgb, var(--wb-accent) 10%, var(--wb-surface-solid)); color: var(--wb-accent); font-weight: 650; }
.wk-nav__item.is-on svg { color: var(--wb-accent); }
@media (max-width: 899px) {
  .wk-nav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
  .wk-nav__group { display: none; }
  .wk-nav__item { flex-shrink: 0; padding: 8px 12px; border-color: var(--wb-border); }
}

/* ---- score ring ------------------------------------------------------------ */
.wk-ring {
  --v: 0;
  --tone: var(--wb-accent);
  position: relative;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: conic-gradient(var(--tone) calc(var(--v) * 1%), var(--wb-surface-sunk) 0);
  font-variant-numeric: tabular-nums;
}
.wk-ring::before { content: ''; position: absolute; inset: 11px; border-radius: 50%; background: var(--wb-surface-solid); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12); }
.wk-ring > * { position: relative; }
.wk-ring strong { display: block; font-family: 'Bricolage Grotesque', 'Geist', system-ui, sans-serif; font-size: 2.6rem; font-weight: 700; line-height: 1; letter-spacing: -.05em; text-align: center; }
.wk-ring span { display: block; margin-top: 2px; color: var(--wb-muted); font-size: .72rem; text-align: center; }
.wk-ring--ok { --tone: var(--wb-ok); }
.wk-ring--warn { --tone: var(--wb-warn); }
.wk-ring--bad { --tone: var(--wb-bad); }
.wk-ring--none { background: var(--wb-surface-sunk); }

/* ---- thin score bar -------------------------------------------------------- */
.wk-bar { --v: 0; display: block; height: 6px; overflow: hidden; border-radius: var(--wb-r-pill); background: var(--wb-surface-sunk); }
.wk-bar::after { content: ''; display: block; width: calc(var(--v) * 1%); height: 100%; border-radius: inherit; background: var(--tone, var(--wb-accent)); }
.wk-bar--ok { --tone: var(--wb-ok); }
.wk-bar--warn { --tone: var(--wb-warn); }
.wk-bar--bad { --tone: var(--wb-bad); }

/* ---- progress -------------------------------------------------------------- */
.wk-progress { display: block; height: 8px; overflow: hidden; border-radius: var(--wb-r-pill); background: var(--wb-surface-sunk); }
.wk-progress > i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--wb-accent); transition: width 240ms var(--wb-ease); }
.wk-progress--bad > i { background: var(--wb-bad); }

/* ---- before / after -------------------------------------------------------- */
.wk-compare {
  --pos: 50%;
  position: relative;
  overflow: hidden;
  border-radius: calc(var(--wb-r-lg) - 6px);
  background-color: var(--wb-surface-sunk);
  background-image: linear-gradient(45deg, var(--wb-border) 25%, transparent 25%, transparent 75%, var(--wb-border) 75%),
                    linear-gradient(45deg, var(--wb-border) 25%, transparent 25%, transparent 75%, var(--wb-border) 75%);
  background-position: 0 0, 8px 8px;
  background-size: 16px 16px;
  user-select: none;
}
.wk-compare img { display: block; width: 100%; height: 100%; max-height: min(62vh, 640px); object-fit: contain; pointer-events: none; }
.wk-compare__after { position: absolute; inset: 0; clip-path: inset(0 0 0 var(--pos)); }
.wk-compare__line { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px; background: var(--wb-surface-solid); box-shadow: 0 0 0 1px var(--wb-border-strong); pointer-events: none; }
.wk-compare__knob {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border: 1px solid var(--wb-border-strong);
  border-radius: 50%;
  background: var(--wb-surface-solid);
  color: var(--wb-text-soft);
  box-shadow: var(--wb-shadow-sm);
}
.wk-compare__knob svg { width: 18px; height: 18px; }
.wk-compare__tag {
  position: absolute;
  top: 12px;
  padding: 4px 10px;
  border-radius: var(--wb-r-pill);
  background: var(--wb-surface);
  -webkit-backdrop-filter: blur(var(--wb-blur));
  backdrop-filter: blur(var(--wb-blur));
  color: var(--wb-text);
  font-size: .72rem;
  font-weight: 650;
  pointer-events: none;
}
.wk-compare__tag--before { left: 12px; }
.wk-compare__tag--after { right: 12px; }
.wk-compare input[type="range"] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.wk-compare:has(input:focus-visible) .wk-compare__knob { outline: 2px solid var(--wb-accent); outline-offset: 2px; }

@media (max-width: 899px) {
  .wk-studio__body { display: flex; flex-direction: column; min-height: 0; }
  .wk-studio__panel { overflow: visible; border-right: 0; border-bottom: 1px solid var(--wb-border); border-radius: 0; }
  .wk-studio__canvas { overflow: visible; padding: 16px; border-radius: 0 0 var(--wb-r-lg) var(--wb-r-lg); }
}
@media (max-width: 599px) {
  .wk-studio__bar { padding: 8px 10px; gap: 8px; }
  .wk-studio__back { padding: 0 8px; }
  .wk-studio__back span { display: none; }
  .wk-studio__title { order: 5; flex-basis: 100%; margin: 0; padding: 0; border: 0; }
  .wk-studio__tag { display: none; }
  .wk-studio__acts { flex-wrap: nowrap; gap: 6px; margin-left: auto; }
  /* The main button keeps only its icon here (it carries an aria-label). */
  .wk-studio__acts .wk-cta { padding: 4px; }
  .wk-studio__acts .wk-cta > span:not(.wk-cta__ico) { display: none; }
  .wk-studio__acts .wb-btn--ghost > span { display: none; }
  .wk-studio__acts .wb-btn--ghost { padding: 8px 10px; }
  .wk-studio__panel { padding: 16px; }
  .wk-studio__canvas { padding: 12px; }
  .wk-ring { width: 108px; height: 108px; }
  .wk-ring strong { font-size: 2.1rem; }
}
@media (prefers-reduced-transparency: reduce) {
  .wk-studio__bar, .wk-compare__tag { background: var(--wb-surface-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  .wk-studio__menu, .wk-progress > i { transition: none !important; }
  .wk-studio__menu:active { transform: none !important; }
}

/* ==========================================================================
   Studio workspace: icon rail, panel and canvas (QR Studio's layout, shared)
   ==========================================================================
 *   .wk-ws                 the workspace under .wk-studio__bar, in place of
 *                          .wk-studio__body: three columns,
 *     > nav.wk-rail        icon tabs (buttons role=tab: svg + span, aria-selected),
 *                          drawn by WK.rail() in wb-kit.js; a count goes in <em>
 *     > .wk-pane           the open tab's controls (it scrolls): h2 + .wk-note,
 *                          then .wk-sec groups of .wk-field (a .wk-label above a control)
 *     > .wk-cv             the canvas on a dot grid: .wk-cv__head (view switches),
 *                          .wk-cv__stage (the artwork), .wk-cv__bar (floating glass
 *                          toolbar), .wk-cv__note
 *   Panel parts            .wk-sugg (suggestion chips), .wk-tiles > .wk-tile (shape and
 *                          format pickers, aria-pressed; --cols sets the columns),
 *                          .wk-gallery > .wk-gcard (template cards with a live preview in
 *                          .wk-gcard__art, --ratio sets its shape), .wk-swatches > .wk-swatch
 *                          (style="--c:#hex", aria-pressed), .wb-color (colour + hex),
 *                          .wk-check (checkbox row), .wk-drop (drop zone, .is-over while
 *                          a file is dragged over), .wk-picks > .wk-pickrow (checkable rows),
 *                          .wk-note (--warn, --bad), .wk-row2 (two fields side by side)
 *   Bar parts              .wk-iconbtn (undo, redo, zoom), .wk-save (save status;
 *                          data-tone="bad" when it failed)
 *   .wk-pop                glass popover under the bar's right end (downloads)
 *   Below 900px the workspace stacks: the canvas first (sticky, --wk-cv-h tall), the
 *   rail as a horizontal scroller, then the panel. .wk-ws--flow keeps a long canvas
 *   (an e-mail being written) in the page flow instead.
 */
.wk-ws { display: grid; grid-template-columns: 72px 340px minmax(0, 1fr); flex: 1 1 auto; min-height: 620px; }
.wk-ws [hidden] { display: none !important; }
.wk-ws :is(button, input, select, textarea) { font: inherit; }

.wk-rail {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  padding: 14px 7px;
  overflow-y: auto;
  border-right: 1px solid var(--wb-border);
  border-radius: 0 0 0 var(--wb-r-lg);
  background: var(--wb-surface-solid);
  scrollbar-width: none;
}
.wk-rail button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  gap: 6px;
  min-height: 62px;
  padding: 9px 2px;
  border: 1px solid transparent;
  border-radius: var(--wb-r-sm);
  background: transparent;
  color: var(--wb-muted);
  cursor: pointer;
  transition: color 160ms var(--wb-ease), background-color 160ms var(--wb-ease), transform 160ms var(--wb-ease);
}
.wk-rail button svg { width: 20px; height: 20px; flex-shrink: 0; }
.wk-rail button span { max-width: 100%; font-size: .62rem; font-weight: 600; line-height: 1.2; text-align: center; overflow-wrap: anywhere; }
.wk-rail button:hover { background: var(--wb-surface-sunk); color: var(--wb-text); }
.wk-rail button:active { transform: scale(.97); }
.wk-rail button[aria-selected="true"] {
  border-color: color-mix(in srgb, var(--wb-accent) 20%, transparent);
  background: color-mix(in srgb, var(--wb-accent) 10%, var(--wb-surface-solid));
  color: var(--wb-accent);
}
.wk-rail button em {
  position: absolute;
  top: 5px;
  right: 6px;
  min-width: 17px;
  padding: 1px 5px;
  border-radius: var(--wb-r-pill);
  background: var(--wb-accent);
  color: var(--wb-accent-contrast);
  font-size: .58rem;
  font-style: normal;
  font-weight: 700;
  line-height: 15px;
  font-variant-numeric: tabular-nums;
}

.wk-pane {
  min-width: 0;
  min-height: 0;
  padding: 22px 20px 28px;
  overflow-y: auto;
  border-right: 1px solid var(--wb-border);
  background: var(--wb-surface-solid);
  scrollbar-width: thin;
  scrollbar-color: var(--wb-border-strong) transparent;
}
.wk-pane > h2 { margin: 0 0 6px; font: 700 1.35rem/1.2 'Bricolage Grotesque', 'Geist', system-ui, sans-serif; letter-spacing: -.02em; }
.wk-pane > h2 + .wk-note { margin-bottom: 18px; }
.wk-pane h3 { margin: 0 0 10px; color: var(--wb-text); font-size: .8rem; font-weight: 650; }
.wk-pane :is(.wb-input, .wb-select, .wb-textarea) { padding: 9px 11px; font-size: .84rem; }
.wk-pane .wb-textarea { min-height: 84px; line-height: 1.5; }
.wk-pane input[type="range"] { width: 100%; height: 22px; margin: 0; accent-color: var(--wb-accent); cursor: pointer; }
.wk-pane .wb-color { padding: 5px 8px 5px 5px; }
.wk-pane .wb-color input[type="color"] { width: 30px; height: 30px; flex-shrink: 0; }
.wk-pane .wb-color input[type="text"] { width: 100%; min-width: 0; padding: 4px; border: 0; background: transparent; color: var(--wb-text); font-size: .8rem; font-variant-numeric: tabular-nums; }
.wk-sec { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--wb-border); }
.wk-field { display: grid; gap: 7px; min-width: 0; margin: 0 0 16px; }
.wk-label { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; color: var(--wb-text-soft); font-size: .76rem; font-weight: 550; }
.wk-label output, .wk-label small { color: var(--wb-muted); font-size: .7rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.wk-note { margin: 0 0 12px; color: var(--wb-text-soft); font-size: .78rem; line-height: 1.55; overflow-wrap: anywhere; }
.wk-note--warn { padding: 9px 11px; border-radius: var(--wb-r-sm); background: var(--wb-warn-bg); color: var(--wb-text); }
.wk-note--bad { padding: 9px 11px; border-radius: var(--wb-r-sm); background: var(--wb-bad-bg); color: var(--wb-text); }
.wk-row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.wk-sugg { display: flex; flex-wrap: wrap; gap: 6px; }
.wk-sugg button {
  max-width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--wb-border);
  border-radius: var(--wb-r-pill);
  background: var(--wb-surface-solid);
  color: var(--wb-text-soft);
  font-size: .74rem;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms var(--wb-ease), background-color 160ms var(--wb-ease), transform 160ms var(--wb-ease);
}
.wk-sugg button:hover { border-color: var(--wb-border-strong); background: var(--wb-surface-sunk); color: var(--wb-text); }
.wk-sugg button:active { transform: scale(.97); }
.wk-sugg button[aria-pressed="true"] { border-color: var(--wb-accent); color: var(--wb-accent); }

.wk-tiles { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 7px; }
.wk-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 76px;
  padding: 9px 5px 8px;
  border: 1px solid var(--wb-border);
  border-radius: 14px;
  background: var(--wb-surface-solid);
  color: var(--wb-text-soft);
  cursor: pointer;
  transition: border-color 160ms var(--wb-ease), background-color 160ms var(--wb-ease), transform 160ms var(--wb-ease);
}
.wk-tile svg { width: 40px; height: 40px; max-width: 100%; flex-shrink: 0; }
.wk-tile span { max-width: 100%; font-size: .66rem; font-weight: 550; line-height: 1.3; text-align: center; overflow-wrap: anywhere; }
.wk-tile small { max-width: 100%; color: var(--wb-muted); font-size: .62rem; line-height: 1.3; text-align: center; }
.wk-tile:hover { border-color: var(--wb-border-strong); background: var(--wb-surface-sunk); }
.wk-tile:active { transform: scale(.97); }
.wk-tile[aria-pressed="true"] { border-color: var(--wb-accent); box-shadow: 0 0 0 1px var(--wb-accent); color: var(--wb-accent); }
.wk-tile:disabled { opacity: .45; cursor: not-allowed; }

.wk-gallery { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 11px; }
.wk-gcard {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 8px 8px 11px;
  border: 1px solid var(--wb-border);
  border-radius: 14px;
  background: var(--wb-surface-solid);
  color: var(--wb-text-soft);
  text-align: left;
  cursor: pointer;
  transition: transform 180ms var(--wb-ease), border-color 160ms var(--wb-ease), box-shadow 160ms var(--wb-ease);
}
.wk-gcard:hover { transform: translateY(-2px); border-color: var(--wb-border-strong); }
.wk-gcard:active { transform: scale(.97); }
.wk-gcard[aria-pressed="true"] { border-color: var(--wb-accent); box-shadow: 0 0 0 1px var(--wb-accent); }
.wk-gcard__art {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: var(--ratio, 3 / 4);
  overflow: hidden;
  border-radius: var(--wb-r-sm);
  background: var(--wb-surface-sunk);
}
.wk-gcard__art > :is(canvas, img, svg) { display: block; max-width: 100%; max-height: 100%; }
.wk-gcard strong { padding-inline: 3px; color: var(--wb-text); font-size: .76rem; font-weight: 650; line-height: 1.3; }
.wk-gcard small { padding-inline: 3px; color: var(--wb-muted); font-size: .68rem; line-height: 1.4; }

.wk-swatches { display: grid; grid-template-columns: repeat(var(--cols, 8), minmax(0, 1fr)); gap: 7px; }
.wk-swatch {
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid var(--wb-surface-solid);
  border-radius: 50%;
  background: var(--c, #888);
  box-shadow: 0 0 0 1px var(--wb-border-strong);
  cursor: pointer;
  transition: transform 160ms var(--wb-ease), box-shadow 160ms var(--wb-ease);
}
.wk-swatch:hover { transform: scale(1.06); }
.wk-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--wb-accent); }

.wk-check { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 12px; color: var(--wb-text-soft); font-size: .8rem; line-height: 1.45; cursor: pointer; }
.wk-check input { flex: 0 0 auto; width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--wb-accent); }
.wk-check strong { color: var(--wb-text); font-weight: 600; }

.wk-drop {
  display: grid;
  justify-items: center;
  gap: 7px;
  width: 100%;
  padding: 22px 14px;
  border: 1px dashed var(--wb-border-strong);
  border-radius: var(--wb-r-lg);
  background: var(--wb-surface-sunk);
  color: var(--wb-text-soft);
  font-size: .78rem;
  line-height: 1.45;
  text-align: center;
  cursor: pointer;
  transition: border-color 160ms var(--wb-ease), background-color 160ms var(--wb-ease);
}
.wk-drop svg { width: 26px; height: 26px; color: var(--wb-muted); }
.wk-drop strong { color: var(--wb-text); font-size: .84rem; }
.wk-drop:hover, .wk-drop.is-over { border-color: var(--wb-accent); background: color-mix(in srgb, var(--wb-accent) 6%, var(--wb-surface-sunk)); }

.wk-picks { display: grid; gap: 6px; max-height: 320px; overflow-y: auto; padding: 2px; scrollbar-width: thin; }
.wk-pickrow { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px 10px; border: 1px solid var(--wb-border); border-radius: var(--wb-r-sm); background: var(--wb-surface-solid); cursor: pointer; }
.wk-pickrow input { flex: 0 0 auto; accent-color: var(--wb-accent); }
.wk-pickrow > span { display: grid; flex: 1 1 auto; min-width: 0; }
.wk-pickrow strong, .wk-pickrow small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-pickrow strong { color: var(--wb-text); font-size: .8rem; font-weight: 600; }
.wk-pickrow small { color: var(--wb-muted); font-size: .72rem; }
.wk-pickrow:has(input:checked) { border-color: var(--wb-accent); }

.wk-cv {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: 0 0 var(--wb-r-lg) 0;
  background-color: var(--wb-surface-sunk);
  background-image: radial-gradient(var(--wb-border-strong) .7px, transparent .7px);
  background-size: 18px 18px;
}
.wk-cv__head { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; width: 100%; padding: 16px 18px 0; }
.wk-cv__head .wk-seg { background: var(--wb-surface-solid); }
.wk-cv__stage { position: relative; display: grid; place-items: center; flex: 1 1 auto; width: 100%; min-height: 0; padding: 26px; overflow: auto; scrollbar-width: thin; }
.wk-cv__bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 6px 0 0;
  padding: 5px 7px;
  border: 1px solid var(--wb-border-strong);
  border-radius: var(--wb-r-pill);
  background: var(--wb-surface);
  -webkit-backdrop-filter: blur(var(--wb-blur));
  backdrop-filter: blur(var(--wb-blur));
  box-shadow: var(--wb-shadow-sm);
}
.wk-cv__sep { width: 1px; height: 18px; margin: 0 3px; background: var(--wb-border); }
.wk-cv__zoom { min-width: 50px; padding: 4px; border: 0; background: none; color: var(--wb-text-soft); font-size: .72rem; font-variant-numeric: tabular-nums; cursor: pointer; }
.wk-cv__note { margin: 10px 12px 16px; color: var(--wb-muted); font-size: .7rem; line-height: 1.5; text-align: center; }

.wk-iconbtn {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--wb-r-sm);
  background: transparent;
  color: var(--wb-text-soft);
  cursor: pointer;
  transition: background-color 160ms var(--wb-ease), transform 160ms var(--wb-ease);
}
.wk-iconbtn svg { width: 18px; height: 18px; }
.wk-iconbtn:hover:not(:disabled) { border-color: var(--wb-border); background: var(--wb-surface-sunk); color: var(--wb-text); }
.wk-iconbtn:active:not(:disabled) { transform: scale(.95); }
.wk-iconbtn:disabled { opacity: .4; cursor: default; }
.wk-iconbtn[aria-pressed="true"] { color: var(--wb-accent); }
.wk-save { color: var(--wb-muted); font-size: .72rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.wk-save[data-tone="bad"] { color: var(--wb-bad); font-weight: 600; }

.wk-pop {
  position: absolute;
  z-index: 20;
  top: 68px;
  right: 14px;
  width: min(370px, calc(100% - 28px));
  max-height: min(78dvh, 760px);
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--wb-border-strong);
  border-radius: var(--wb-r-lg);
  background: var(--wb-surface);
  -webkit-backdrop-filter: blur(var(--wb-blur));
  backdrop-filter: blur(var(--wb-blur));
  box-shadow: var(--wb-shadow-lg);
  color: var(--wb-text);
  animation: wk-pop-in 180ms var(--wb-ease);
}
@keyframes wk-pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.wk-pop__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 16px; }
.wk-pop__head h2 { margin: 0; font: 700 1.25rem/1.2 'Bricolage Grotesque', 'Geist', system-ui, sans-serif; letter-spacing: -.02em; }

@media (min-width: 900px) {
  :root[data-focus] .wk-ws { min-height: 0; }
}
@media (min-width: 900px) and (max-width: 1250px) {
  .wk-ws { grid-template-columns: 64px 300px minmax(0, 1fr); }
  .wk-cv__stage { padding: 18px; }
}
@media (max-width: 899px) {
  .wk-ws { display: flex; flex-direction: column; min-height: 0; }
  .wk-cv { order: 0; position: sticky; top: 0; z-index: 3; flex-shrink: 0; height: var(--wk-cv-h, 360px); border-radius: 0; border-bottom: 1px solid var(--wb-border); }
  .wk-cv__head { padding: 10px 12px 0; }
  .wk-cv__stage { padding: 12px; }
  .wk-cv__note { display: none; }
  .wk-ws--flow .wk-cv { position: static; height: auto; overflow: visible; }
  .wk-ws--flow .wk-cv__stage { overflow: visible; }
  .wk-rail { order: 1; flex-direction: row; gap: 5px; padding: 8px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--wb-border); border-radius: 0; }
  .wk-rail button { min-width: 66px; min-height: 52px; padding: 6px 10px; gap: 4px; }
  .wk-rail button span { font-size: .66rem; }
  .wk-pane { order: 2; overflow: visible; padding: 20px 16px 26px; border-right: 0; border-radius: 0 0 var(--wb-r-lg) var(--wb-r-lg); }
  .wk-pop { position: fixed; top: auto; right: 12px; bottom: 12px; left: 12px; width: auto; max-height: 85dvh; }
}
@media (prefers-reduced-transparency: reduce) {
  .wk-cv__bar, .wk-pop { background: var(--wb-surface-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  .wk-rail button, .wk-sugg button, .wk-tile, .wk-gcard, .wk-swatch, .wk-iconbtn, .wk-drop { transition: none !important; }
  .wk-pop { animation: none !important; }
  .wk-gcard:hover, .wk-swatch:hover { transform: none; }
}
