/* desk.css — the Workspace shell (the installable app at /app/; controller: js/desk.js).
   The sidebar is a fixed dark rail (the Caspian house palette); the content pane follows the
   app's own light/dark tokens so every tool renders exactly as it does on the site. Every class
   is prefixed dk-. The site's own chrome (header, mega-menu, footer, help block) is hidden, never
   removed, so app.js keeps every element it expects. Loaded only by /app/index.html. */
:root {
  --dk-w: 272px;
  --dk-top-h: 56px;
  --dk-base: #0b0e14;
  --dk-raised: #141925;
  --dk-over: #1c2333;
  --dk-line: #232a3a;
  --dk-line2: #2e3850;
  --dk-text: #e8ecf4;
  --dk-text2: #a4aec4;
  --dk-muted: #6b7488;
  --dk-accent: #e2364d;
  --dk-accent-soft: rgba(226, 54, 77, 0.16);
  --dk-radius: 8px;
}
html[data-dk-collapsed] { --dk-w: 64px; }

/* ---- the app's own chrome, parked ------------------------------------------------------- */
body > header,
footer.site-footer,
#megamenu, #megamenuOverlay,
#tool-help,
#header-download,
main .tool-view .instructions, main .tool-view [data-intro],
#co-fab,
#view-home { display: none !important; }

html, body { height: auto; }
body { padding-left: var(--dk-w); transition: padding-left .18s ease; }
main { padding: 24px 32px 56px; max-width: 1480px; margin: 0 auto; }
@media (max-width: 760px) { main { padding: 16px 16px 40px; } }

/* ---- sidebar ---------------------------------------------------------------------------- */
.dk-side {
  position: fixed; inset: 0 auto 0 0; width: var(--dk-w); z-index: 120;
  background: var(--dk-base); color: var(--dk-text2);
  border-right: 1px solid var(--dk-line);
  display: flex; flex-direction: column;
  font-family: var(--font-ui); font-size: 13.5px; line-height: 1.4;
  transition: width .18s ease, transform .2s ease;
  color-scheme: dark;
}
.dk-side *, .dk-topbar * { box-sizing: border-box; }
.dk-side button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; text-align: left; }
.dk-side button:focus-visible, .dk-topbar button:focus-visible, .dk-search-input:focus-visible, .dk-lang:focus-visible { outline: 2px solid var(--dk-accent); outline-offset: 1px; }

.dk-brand { display: flex; align-items: center; gap: 6px; height: var(--dk-top-h); padding: 0 12px 0 14px; border-bottom: 1px solid var(--dk-line); flex: 0 0 auto; }
.dk-brand-btn { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; padding: 6px 4px; border-radius: var(--dk-radius); }
.dk-brand-btn:hover { background: var(--dk-raised); }
.dk-mark { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 7px; display: grid; place-items: center; color: #fff; background: linear-gradient(160deg, #e2364d, #b30d29); box-shadow: 0 2px 8px rgba(226, 54, 77, .35); }
.dk-brand-text { display: flex; align-items: baseline; gap: 8px; min-width: 0; white-space: nowrap; }
.dk-brand-name { color: var(--dk-text); font-size: 15px; font-weight: 500; letter-spacing: -.01em; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.dk-brand-name b { font-weight: 700; }
.dk-brand-ver { flex: 0 0 auto; font-size: 10.5px; color: var(--dk-muted); font-variant-numeric: tabular-nums; padding: 1px 6px; border: 1px solid var(--dk-line2); border-radius: 999px; margin-right: 4px; white-space: nowrap; }

/* The reset matters for the top bar's hamburger (#dk-menu): it lives outside .dk-side, whose button
   reset would otherwise be the only thing stripping the browser's native bevel. */
.dk-iconbtn { width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 7px; background: none; color: var(--dk-muted); font: inherit; cursor: pointer; }
.dk-iconbtn:hover { background: var(--dk-raised); color: var(--dk-text); }

.dk-search { position: relative; display: flex; align-items: center; margin: 12px 12px 6px; flex: 0 0 auto; }
.dk-search-ic { position: absolute; left: 10px; color: var(--dk-muted); pointer-events: none; }
.dk-search-input { width: 100%; height: 34px; padding: 0 30px 0 32px; border-radius: var(--dk-radius); border: 1px solid var(--dk-line); background: var(--dk-raised); color: var(--dk-text); font: inherit; font-size: 13px; outline: none; }
.dk-search-input::placeholder { color: var(--dk-muted); }
.dk-search-input:focus { border-color: var(--dk-line2); background: var(--dk-over); }
.dk-kbd { position: absolute; right: 9px; font: 600 10.5px/1 var(--font-ui); color: var(--dk-muted); border: 1px solid var(--dk-line2); border-radius: 4px; padding: 3px 5px; pointer-events: none; }
.dk-search-input:focus ~ .dk-kbd, .dk-search:has(.dk-search-input:not(:placeholder-shown)) .dk-kbd { display: none; }
.dk-search-clear { position: absolute; right: 8px; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 5px; color: var(--dk-muted); }
.dk-search-clear:hover { color: var(--dk-text); background: var(--dk-over); }

/* All tools / Favourites / Recent / Collections: fixed above the scrolling tree, so opening a tool
   deep in a section never leaves them scrolled away. Its own short lists scroll inside it. */
.dk-primary { flex: 0 0 auto; max-height: 38vh; overflow-y: auto; overflow-x: hidden; padding: 4px 8px 6px; border-bottom: 1px solid var(--dk-line); scrollbar-width: thin; scrollbar-color: var(--dk-line2) transparent; }
.dk-primary:empty { display: none; }
.dk-side.dk-searching .dk-primary { display: none; }
.dk-mini { position: relative; }
.dk-mini > .dk-item { padding-right: 34px; }
.dk-item-static { cursor: pointer; }
.dk-mini-tog { position: absolute; top: 5px; right: 4px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; color: var(--dk-muted); }
.dk-mini-tog:hover { background: var(--dk-over); color: var(--dk-text); }
.dk-mini-tog .dk-chev { transition: transform .15s ease; }
.dk-mini.open > .dk-mini-tog .dk-chev { transform: rotate(90deg); }
.dk-mini > .dk-item .dk-count { margin-right: 2px; }
.dk-mini-body { display: none; padding: 0 0 4px; margin-left: 17px; border-left: 1px solid var(--dk-line); }
.dk-mini.open > .dk-mini-body { display: block; }
[dir="rtl"] .dk-mini > .dk-item { padding-right: 10px; padding-left: 34px; }
[dir="rtl"] .dk-mini-tog { right: auto; left: 4px; }
[dir="rtl"] .dk-mini-tog .dk-chev { transform: scaleX(-1); }
[dir="rtl"] .dk-mini.open > .dk-mini-tog .dk-chev { transform: rotate(90deg); }
[dir="rtl"] .dk-mini-body { margin-left: 0; margin-right: 17px; border-left: 0; border-right: 1px solid var(--dk-line); }

.dk-nav { flex: 1 1 0; min-height: 96px; overflow-y: auto; overflow-x: hidden; padding: 4px 8px 12px; scrollbar-width: thin; scrollbar-color: var(--dk-line2) transparent; }
.dk-nav::-webkit-scrollbar { width: 8px; }
.dk-nav::-webkit-scrollbar-thumb { background: var(--dk-line2); border-radius: 8px; }

.dk-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px; border-radius: 7px; color: var(--dk-text2); white-space: nowrap; }
.dk-item:hover { background: var(--dk-raised); color: var(--dk-text); }
.dk-item.active { background: var(--dk-over); color: var(--dk-text); }
.dk-item.active .dk-item-ic { color: var(--dk-accent); }
.dk-item-ic { width: 18px; flex: 0 0 18px; display: grid; place-items: center; color: var(--dk-muted); }
.dk-item-lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.dk-count { font-size: 11px; color: var(--dk-muted); font-variant-numeric: tabular-nums; }
.dk-item.active .dk-count { color: var(--dk-text2); }

.dk-eyebrow { display: flex; align-items: center; justify-content: space-between; padding: 14px 10px 6px; font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--dk-muted); }
.dk-eyebrow:first-child { padding-top: 6px; }
.dk-eyebrow-btn { width: 22px; height: 22px; display: grid; place-items: center; margin: -4px -4px -4px 0; border-radius: 5px; color: var(--dk-muted); }
.dk-eyebrow-btn:hover { background: var(--dk-raised); color: var(--dk-text); }

.dk-sec { margin: 1px 0; }
.dk-sec-head { display: flex; align-items: center; gap: 8px; width: 100%; height: 34px; padding: 0 8px 0 6px; border-radius: 7px; color: var(--dk-text2); white-space: nowrap; }
.dk-sec-head:hover { background: var(--dk-raised); color: var(--dk-text); }
.dk-sec.open > .dk-sec-head { position: sticky; top: -4px; z-index: 2; background: var(--dk-base); box-shadow: 0 6px 6px -6px rgba(0, 0, 0, .6); }
.dk-sec.open > .dk-sec-head:hover { background: var(--dk-raised); }
.dk-sec.has-active > .dk-sec-head { color: var(--dk-text); }
.dk-chev { width: 14px; flex: 0 0 14px; color: var(--dk-muted); transition: transform .15s ease; }
.dk-sec.open .dk-chev { transform: rotate(90deg); }
.dk-sec-ic { width: 18px; flex: 0 0 18px; display: grid; place-items: center; color: var(--dk-muted); }
.dk-sec.has-active > .dk-sec-head .dk-sec-ic { color: var(--dk-accent); }
.dk-sec-lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.dk-sec-body { display: none; padding: 2px 0 6px 0; margin-left: 15px; border-left: 1px solid var(--dk-line); }
.dk-sec.open .dk-sec-body { display: block; }
.dk-cat { padding: 8px 0 3px 14px; font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--dk-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dk-tool { display: flex; align-items: center; gap: 9px; width: calc(100% - 4px); height: 30px; margin: 0 0 0 4px; padding: 0 8px 0 10px; border-radius: 6px; color: var(--dk-text2); white-space: nowrap; font-size: 13px; }
.dk-tool:hover { background: var(--dk-raised); color: var(--dk-text); }
.dk-tool.active { background: var(--dk-over); color: var(--dk-text); font-weight: 500; box-shadow: inset 2px 0 0 var(--dk-accent); }
[dir="rtl"] .dk-tool.active { box-shadow: inset -2px 0 0 var(--dk-accent); }
.dk-tool.active .dk-tool-ic { color: var(--dk-accent); }
.dk-tool-ic { width: 16px; flex: 0 0 16px; display: grid; place-items: center; color: var(--dk-muted); }
.dk-tool-lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.dk-tool .tool-new-pill { margin-left: 4px; }

/* search results (replace the tree while a query is present) */
.dk-results { padding: 2px 0; }
.dk-res { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border-radius: 7px; color: var(--dk-text2); }
.dk-res:hover, .dk-res.kb-active { background: var(--dk-over); color: var(--dk-text); }
.dk-res-ic { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 7px; display: grid; place-items: center; background: color-mix(in srgb, var(--cat, #c8102e) 18%, transparent); color: var(--cat, #e2364d); }
.dk-res-txt { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.dk-res-name { font-size: 13px; color: var(--dk-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dk-res-name mark { background: none; color: var(--dk-accent); font-weight: 600; }
.dk-res-cat { font-size: 11px; color: var(--dk-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dk-side .dk-res-all { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; border-radius: 7px; border-top: 1px solid var(--dk-line); font-size: 12.5px; color: var(--dk-text2); text-align: center; }
.dk-res-all:hover { background: var(--dk-raised); color: var(--dk-text); }
.dk-res-empty { padding: 18px 10px; font-size: 13px; color: var(--dk-muted); text-align: center; }
.dk-res-hint { padding: 8px 10px 4px; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--dk-muted); font-weight: 600; }

.dk-foot { flex: 0 0 auto; padding: 8px 8px 10px; border-top: 1px solid var(--dk-line); }
.dk-item[hidden] { display: none; }
.dk-foot-row { display: flex; align-items: center; gap: 6px; padding: 6px 2px 0; }
.dk-foot-spacer { flex: 1; }
.dk-private { display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; font-size: 10.5px; color: var(--dk-muted); white-space: nowrap; padding-right: 4px; }
.dk-side .dk-brand-ver { cursor: pointer; border: 1px solid var(--dk-line2); }
.dk-brand-ver:hover { color: var(--dk-text); border-color: var(--dk-muted); }
.dk-foot-row { overflow: hidden; }
.dk-ic-sun { display: none; }
html[data-theme="dark"] .dk-ic-sun { display: block; }
html[data-theme="dark"] .dk-ic-moon { display: none; }

/* collapsed rail */
html[data-dk-collapsed] .dk-brand { padding: 0 0 0 0; justify-content: center; flex-direction: column; height: auto; gap: 2px; padding: 10px 0 8px; }
html[data-dk-collapsed] .dk-brand-btn { flex: 0 0 auto; padding: 4px; }
html[data-dk-collapsed] .dk-brand-text,
html[data-dk-collapsed] .dk-search-input, html[data-dk-collapsed] .dk-kbd, html[data-dk-collapsed] .dk-search-clear,
html[data-dk-collapsed] .dk-item-lbl, html[data-dk-collapsed] .dk-count, html[data-dk-collapsed] .dk-eyebrow,
html[data-dk-collapsed] .dk-sec-lbl, html[data-dk-collapsed] .dk-chev, html[data-dk-collapsed] .dk-sec-body,
html[data-dk-collapsed] .dk-private, html[data-dk-collapsed] .dk-brand-ver, html[data-dk-collapsed] .dk-results { display: none !important; }
html[data-dk-collapsed] .dk-search { justify-content: center; margin: 10px 0 4px; }
html[data-dk-collapsed] .dk-search-ic { position: static; width: 34px; height: 34px; padding: 9px; border-radius: 8px; color: var(--dk-text2); pointer-events: auto; cursor: pointer; }
html[data-dk-collapsed] .dk-search-ic:hover { background: var(--dk-raised); color: var(--dk-text); }
html[data-dk-collapsed] .dk-nav { padding: 4px 0 12px; }
html[data-dk-collapsed] .dk-primary { padding: 4px 0 6px; display: flex; flex-direction: column; align-items: center; max-height: none; overflow: visible; }
html[data-dk-collapsed] .dk-mini-tog, html[data-dk-collapsed] .dk-mini-body, html[data-dk-collapsed] .dk-mini[data-mini="recent"] { display: none !important; }
html[data-dk-collapsed] .dk-mini > .dk-item { padding: 0; }
html[data-dk-collapsed] .dk-item, html[data-dk-collapsed] .dk-sec-head { width: 40px; margin: 2px auto; padding: 0; justify-content: center; }
html[data-dk-collapsed] .dk-tree { display: flex; flex-direction: column; align-items: center; }
html[data-dk-collapsed] .dk-sec { width: 100%; }
html[data-dk-collapsed] .dk-foot { padding: 8px 0 10px; }
html[data-dk-collapsed] .dk-foot-row { flex-direction: column; padding: 4px 0 0; }
html[data-dk-collapsed] .dk-collapse svg { transform: scaleX(-1); }

/* ---- top bar ----------------------------------------------------------------------------- */
.dk-topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 110;
  height: var(--dk-top-h); display: flex; align-items: center; gap: 14px;
  padding: 0 24px 0 20px; background: var(--panel); border-bottom: 1px solid var(--border);
  font-family: var(--font-ui);
}
.dk-menu { display: none; color: var(--ink-soft); }
.dk-menu:hover { background: var(--bg); color: var(--ink); }
.dk-crumb { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-faded); white-space: nowrap; flex: 0 0 auto; }
.dk-crumb:empty { display: none; }
.dk-crumb .dk-crumb-sep { color: var(--border-strong); }
.dk-crumb b { font-weight: 500; color: var(--ink-soft); }
.dk-crumb-link { background: none; border: 0; padding: 4px 6px; margin: 0 -2px; border-radius: 6px; color: var(--ink-faded); font: inherit; cursor: pointer; }
.dk-crumb-link:hover { color: var(--ink); background: var(--bg); }
.dk-crumb-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.dk-anchor { scroll-margin-top: calc(var(--dk-top-h) + 16px); }
.dk-cat-label { scroll-margin-top: calc(var(--dk-top-h) + 16px); }
.dk-top-title { font-size: 15px; font-weight: 600; color: var(--ink); letter-spacing: -.01em; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body:not(.home-active) .dk-top-title { display: none; }
body.home-active .dk-crumb { display: none; }
.dk-top-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.dk-topbtn { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 7px; border: 1px solid var(--border); background: var(--panel); color: var(--ink-soft); font: 500 12.5px var(--font-ui); cursor: pointer; }
.dk-topbtn:hover { border-color: var(--border-strong); color: var(--ink); background: var(--bg); }
.dk-topbtn[hidden] { display: none; }
/* the site header's three buttons, mirrored: favourites (count), updates (dot), language */
.dk-topicon { position: relative; width: 34px; height: 34px; flex: 0 0 34px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--ink-soft); cursor: pointer; }
.dk-topicon:hover { background: var(--bg); color: var(--ink); border-color: var(--border-strong); }
.dk-topicon:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* The count sits on the button's corner, clear of the glyph (it used to be a 32x22 pill that hid
   the top half of the heart). */
.dk-badge { position: absolute; top: -6px; right: -6px; box-sizing: border-box; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--accent); color: #fff; font: 700 10px/14px var(--font-ui); text-align: center; border: 2px solid var(--panel); }
.dk-dot { position: absolute; top: 5px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); border: 1.5px solid var(--panel); }
[dir="rtl"] .dk-badge { right: auto; left: -6px; }
[dir="rtl"] .dk-dot { right: auto; left: 6px; }
/* On the Favourites page the header heart is the current page (aria-current, set in desk.js). */
.dk-topicon.active { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-pale); }
.dk-lang { position: relative; display: inline-flex; }
.dk-lang-btn { width: auto; flex: 0 0 auto; padding: 0 9px 0 8px; display: inline-flex; align-items: center; gap: 5px; }
.dk-lang-code { font: 600 11px var(--font-ui); letter-spacing: .03em; color: var(--ink-soft); }
.dk-lang-menu { min-width: 200px; max-height: 60vh; overflow-y: auto; }
.dk-lang-opt { justify-content: space-between; }
.dk-lang-opt.active { color: var(--accent-ink); background: var(--accent-pale); }
.dk-lang-opt.active svg { color: var(--accent-ink); }
/* avatar + account menu (top right) */
.dk-acct { position: relative; display: inline-flex; }
.dk-avatar { width: 34px; height: 34px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: var(--panel); cursor: pointer; display: grid; place-items: center; }
.dk-avatar:hover { border-color: var(--border-strong); }
.dk-avatar:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dk-avatar-face { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-pale); color: var(--accent-ink); font-family: var(--font-ui); font-size: 11.5px; font-weight: 700; letter-spacing: .02em; }
.dk-avatar-face.has-initials { background: linear-gradient(160deg, #e2364d, #b30d29); color: #fff; }
.dk-acct-menu { position: absolute; top: calc(100% + 8px); right: 0; min-width: 180px; padding: 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); box-shadow: var(--shadow-lg); z-index: 130; }
.dk-acct-menu[hidden] { display: none; }
/* RTL mirrors the top bar, so the avatar and language buttons sit at its left end, next to the
   sidebar (which stays on the left, above the bar). Open the menus towards the content instead of
   under the sidebar. */
[dir="rtl"] .dk-acct-menu { right: auto; left: 0; }
.dk-acct-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 7px; background: none; color: var(--ink); font: 500 13.5px var(--font-ui); cursor: pointer; text-align: left; white-space: nowrap; }
.dk-acct-item svg { color: var(--ink-soft); flex: 0 0 auto; }
.dk-acct-item:hover { background: var(--bg); }

/* the app's tool header, re-housed in the top bar as a single row */
.dk-topbar .tool-header { margin: 0; flex: 1; min-width: 0; align-items: center; gap: 12px; }
.dk-topbar .tool-header-main { display: flex; align-items: center; min-width: 0; flex: 1; }
.dk-topbar .tool-breadcrumb, .dk-topbar .tool-subtitle { display: none; }
.dk-topbar .tool-title { font-size: 15px; font-weight: 600; letter-spacing: -.01em; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
/* The tool's own controls live in the tool rail (below); only the empty share slot stays here. */
.dk-topbar .tool-header-right { display: none; }

/* ---- the tool rail: the open tool's toolbar ---------------------------------------------------
   Everything that belongs to the open tool — its action buttons and Download (#toolActions),
   undo/redo (#toolHistory), its pin heart (#toolFav), Share, its guide and Full screen — sits in one
   toolbar fixed at the right edge, mid-page; the top bar keeps navigation and the app's own controls.
   The containers are flattened (display: contents) so the rail lays out every button itself. Below
   1100px wide it becomes a toolbar centred at the bottom of the content pane, so the tool keeps its
   full width. Kept on the physical right in RTL: the sidebar stays on the left in both directions. */
.dk-toolrail { position: fixed; right: 16px; top: 50%; transform: translateY(-50%); z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 5px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow-lg); font-family: var(--font-ui); }
.dk-toolrail:not(:has(.tool-fav-btn)) { display: none; }
.dk-toolrail > .tool-header-actions, .dk-toolrail > .tool-header-history, .dk-toolrail > .tool-header-fav { display: contents; }
.dk-rail-sep { flex: 0 0 auto; width: 24px; height: 1px; margin: 3px 0; background: var(--border); }
.dk-toolrail:has(> #toolActions:empty):has(> #toolHistory:empty) > .dk-rail-sep { display: none; }
.dk-toolrail .tha-btn, .dk-toolrail .tha-dl-btn, .dk-toolrail .tool-fav-btn, .dk-toolrail .tool-install-btn, .dk-rail-btn { flex: 0 0 auto; width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; gap: 0; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--ink-soft); font: inherit; cursor: pointer; }
.dk-toolrail .tha-btn > svg, .dk-toolrail .tha-dl-btn > svg, .dk-toolrail .tool-fav-btn > svg, .dk-toolrail .tool-install-btn > svg, .dk-rail-btn > svg { width: 18px; height: 18px; }
.dk-toolrail .tha-btn:hover, .dk-toolrail .tool-fav-btn:hover, .dk-toolrail .tool-install-btn:hover, .dk-rail-btn:hover { border-color: transparent; background: var(--accent-pale); color: var(--accent-ink); }
.dk-toolrail .tha-btn:disabled, .dk-toolrail .tha-btn:disabled:hover { border-color: transparent; background: transparent; color: var(--ink-soft); opacity: .38; cursor: not-allowed; }
/* Download (and any primary action) stays the one solid red button. */
.dk-toolrail .tha-dl-btn, .dk-toolrail .tha-btn.primary, .dk-toolrail .tha-btn.primary:hover, .dk-toolrail .tha-dl-btn:hover { border-color: var(--accent); background: var(--accent); color: #fff; }
.dk-toolrail .tha-dl-btn:hover, .dk-toolrail .tha-btn.primary:hover { filter: brightness(.95); }
.dk-toolrail .tha-caret { display: none; }
.dk-toolrail .tool-fav-btn.on, .dk-rail-btn[aria-pressed="true"] { border-color: transparent; background: var(--accent-pale); color: var(--accent-ink); }
.dk-toolrail button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* A menu (the Download formats) opens beside the rail, not off its edge (app.js also keeps it on screen). */
.dk-toolrail .tha-menu { top: 0; right: calc(100% + 12px); left: auto; }
@media (min-width: 1101px) { body:has(#dk-toolrail .tool-fav-btn) main { padding-right: 84px; } }
@media (max-width: 1100px) {
  /* Centred between the content pane's edges with auto margins (a left:50% + translate centre would
     cap its shrink-to-fit width at half the pane and wrap it early); it wraps only when it really
     runs out of room. */
  .dk-toolrail { top: auto; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); left: calc(var(--dk-w) + 12px); right: 12px; margin-inline: auto; width: fit-content; transform: none; flex-direction: row; flex-wrap: wrap; justify-content: center; border-radius: 14px; }
  .dk-rail-sep { width: 1px; height: 24px; margin: 0 3px; }
  .dk-toolrail .tha-menu { top: auto; right: auto; bottom: calc(100% + 12px); left: 0; }
  body:has(#dk-toolrail .tool-fav-btn) main { padding-bottom: 92px; }
}
@media (max-width: 480px) {
  .dk-toolrail { gap: 2px; padding: 4px; }
  .dk-toolrail .tha-btn, .dk-toolrail .tha-dl-btn, .dk-toolrail .tool-fav-btn, .dk-toolrail .tool-install-btn, .dk-rail-btn { width: 34px; height: 34px; }
  .dk-rail-sep { margin: 0 2px; }
}
@media print { .dk-toolrail { display: none !important; } }
/* Keep the site's floating back-to-top button and the status toast clear of the rail: under the
   rail in its gutter on wide screens, above the bottom toolbar (whatever its height) below that. */
@media (min-width: 1101px) { body:has(#dk-toolrail .tool-fav-btn) .back-to-top { right: 18px; bottom: 16px; } }
@media (max-width: 1100px) {
  body:has(#dk-toolrail .tool-fav-btn) .back-to-top { right: 16px; bottom: calc(12px + var(--dk-rail-h, 48px) + 16px + env(safe-area-inset-bottom, 0px)); }
  body:has(#dk-toolrail .tool-fav-btn) .status { bottom: calc(12px + var(--dk-rail-h, 48px) + 12px + env(safe-area-inset-bottom, 0px)); }
}

/* Full screen (the rail's button, desk.js setFull): the tool alone. The sidebar and the top bar
   step aside; the rail stays, since it holds the tool's own buttons. */
html[data-dk-full] { --dk-w: 0px; }
html[data-dk-full] .dk-side, html[data-dk-full] .dk-topbar, html[data-dk-full] .dk-overlay, html[data-dk-full] .dk-migrate { display: none !important; }
html[data-dk-full] body { padding-left: 0; }

/* ---- home (tool overview) --------------------------------------------------------------- */
.dk-home { font-family: var(--font-ui); display: flex; flex-direction: column; gap: 28px; }
.dk-home-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.dk-h1 { font-size: 22px; font-weight: 600; letter-spacing: -.02em; color: var(--ink); margin: 0 0 4px; text-wrap: balance; }
.dk-lede { font-size: 13.5px; color: var(--ink-faded); margin: 0; }
.dk-lede b { color: var(--ink-soft); font-weight: 500; font-variant-numeric: tabular-nums; }
.dk-home-search { position: relative; flex: 0 1 360px; min-width: 240px; }
.dk-home-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-faded); pointer-events: none; }
.dk-home-search input { width: 100%; height: 38px; padding: 0 12px 0 36px; border-radius: 9px; border: 1px solid var(--border); background: var(--panel); color: var(--ink); font: inherit; font-size: 14px; outline: none; }
.dk-home-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-pale); }
.dk-group { display: flex; flex-direction: column; gap: 12px; }
.dk-group-head { display: flex; align-items: center; gap: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.dk-group-ic { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--accent-pale); color: var(--accent-ink); }
.dk-group-title { font-size: 14.5px; font-weight: 600; color: var(--ink); letter-spacing: -.01em; margin: 0; }
.dk-group-count { font-size: 12px; color: var(--ink-faded); font-variant-numeric: tabular-nums; }
.dk-group-action { margin-left: auto; font: 500 12px var(--font-ui); color: var(--ink-faded); background: none; border: 0; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.dk-group-action:hover { color: var(--accent-ink); background: var(--accent-pale); }
.dk-cat-label { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--cat, var(--ink-faded)); margin: 6px 0 -4px; }
.dk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 10px; }
.dk-tile { position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 12px 12px 12px 12px; min-height: 70px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--ink); text-align: left; cursor: pointer; font: inherit; transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease; }
.dk-tile-wrap { position: relative; display: flex; min-width: 0; }
.dk-tile-wrap > .dk-tile { flex: 1; min-width: 0; }
.dk-tile-wrap:hover > .dk-tile { border-color: var(--border-strong); box-shadow: var(--shadow); }
.dk-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dk-tile-ic { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 9px; display: grid; place-items: center; background: color-mix(in srgb, var(--cat, #c8102e) 12%, transparent); color: var(--cat, #c8102e); }
.dk-tile-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.dk-tile-name { font-size: 13.5px; font-weight: 600; letter-spacing: -.005em; color: var(--ink); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding-inline-end: 20px; }
.dk-tile-name mark { background: none; color: var(--accent-ink); }
.dk-tile-sub { font-size: 12px; line-height: 1.4; color: var(--ink-faded); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* The pin heart sits beside the tile's button (app.js withFavStar), in its end corner. */
.dk-tile-wrap .home-card-star { top: 8px; inset-inline-end: 8px; width: 24px; height: 24px; border-radius: 6px; transition: opacity .12s ease; }
.dk-tile-wrap:hover .home-card-star, .dk-tile-wrap:focus-within .home-card-star { opacity: 1; }
.dk-tile-wrap .home-card-star.on svg { fill: currentColor; }
/* Touch screens have no hover: keep every heart faintly visible so pinning stays discoverable. */
@media (hover: none) { .dk-tile-wrap .home-card-star { opacity: .55; } .dk-tile-wrap .home-card-star.on { opacity: 1; } }
.dk-empty { padding: 28px 16px; text-align: center; color: var(--ink-faded); font-size: 13.5px; border: 1px dashed var(--border); border-radius: 10px; }

/* ---- docs -------------------------------------------------------------------------------- */
.dk-docs { font-family: var(--font-ui); display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 32px; align-items: start; }
.dk-docs-nav { position: sticky; top: calc(var(--dk-top-h) + 20px); display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - var(--dk-top-h) - 44px); }
.dk-docs-search { position: relative; }
.dk-docs-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-faded); pointer-events: none; }
.dk-docs-search input { width: 100%; height: 34px; padding: 0 10px 0 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--ink); font: inherit; font-size: 13px; outline: none; }
.dk-docs-search input:focus { border-color: var(--accent); }
.dk-docs-list { overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
.dk-docs-sec { padding: 12px 0 2px; font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faded); }
.dk-docs-link { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border-radius: 6px; border: 0; background: none; color: var(--ink-soft); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.dk-docs-link:hover { background: var(--panel); color: var(--ink); }
.dk-docs-link.active { background: var(--accent-pale); color: var(--accent-ink); font-weight: 500; }
.dk-docs-link svg { flex: 0 0 auto; color: var(--ink-faded); }
.dk-docs-link.active svg { color: var(--accent-ink); }
.dk-docs-body { min-width: 0; max-width: 780px; }
.dk-tabs { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel); margin-bottom: 24px; flex-wrap: wrap; }
.dk-tab { height: 28px; padding: 0 12px; border-radius: 6px; border: 0; background: none; color: var(--ink-soft); font: 500 12.5px var(--font-ui); cursor: pointer; }
.dk-tab:hover { color: var(--ink); background: var(--bg); }
.dk-tab.active { background: var(--invert-bg); color: var(--invert-ink); }
.dk-docs-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faded); margin-bottom: 8px; }
.dk-docs-eyebrow b { color: var(--cat, var(--accent-ink)); font-weight: 600; }
.dk-docs-title { font-size: 26px; font-weight: 600; letter-spacing: -.02em; color: var(--ink); margin: 0 0 8px; text-wrap: balance; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dk-docs-title .dk-tile-ic { width: 40px; height: 40px; flex: 0 0 40px; }
.dk-docs-lede { font-size: 15px; color: var(--ink-soft); line-height: 1.55; margin: 0 0 18px; max-width: 65ch; }
.dk-docs-intro { margin: 0 0 18px; padding: 14px 16px; border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0; background: var(--panel); border-top: 1px solid var(--border); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); font-size: 14px; line-height: 1.6; color: var(--ink-soft); }
.dk-docs-intro-h { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 6px; }
.dk-docs-intro p { margin: 0; }
.dk-docs-intro p + p { margin-top: 8px; }
.dk-docs-intro b { color: var(--ink); }
.dk-docs-intro kbd { font: inherit; font-size: 12px; padding: 1px 5px; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--bg); }
.dk-docs-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.dk-btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--ink); font: 500 13px var(--font-ui); cursor: pointer; }
.dk-btn:hover { border-color: var(--border-strong); background: var(--bg); }
.dk-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.dk-btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.dk-docs-body .tool-help { max-width: none; margin: 8px 0 0; padding-top: 22px; }
.dk-docs-body .tool-help h2:first-child { margin-top: 0; }
.dk-docs-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 6px 0 28px; }
.dk-docs-card { display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); text-align: left; cursor: pointer; color: var(--ink); font: inherit; }
.dk-docs-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.dk-docs-card b { font-size: 13.5px; font-weight: 600; }
.dk-docs-card span { font-size: 12.5px; color: var(--ink-faded); line-height: 1.45; }
.dk-docs-index { columns: 2; column-gap: 32px; }
.dk-docs-index h3 { break-after: avoid; font-size: 12.5px; font-weight: 600; color: var(--ink); margin: 0 0 6px; }
.dk-docs-index ul { list-style: none; margin: 0 0 18px; padding: 0; break-inside: avoid-column; }
.dk-docs-index li { margin: 0; }
.dk-docs-index button { background: none; border: 0; padding: 3px 0; color: var(--ink-soft); font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.dk-docs-index button:hover { color: var(--accent-ink); text-decoration: underline; }

/* ---- responsive -------------------------------------------------------------------------- */
@media (max-width: 1000px) {
  .dk-docs { grid-template-columns: 1fr; gap: 20px; }
  .dk-docs-nav { position: static; max-height: 260px; }
  .dk-docs-index { columns: 1; }
}
@media (max-width: 900px) {
  :root { --dk-w: 0px; }
  html[data-dk-collapsed] { --dk-w: 0px; }
  body { padding-left: 0; }
  .dk-side { width: 288px; transform: translateX(-100%); box-shadow: none; visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; }
  .dk-side.open { transform: none; box-shadow: 0 0 60px rgba(0,0,0,.45); visibility: visible; transition: transform .2s ease, visibility 0s; }
  html[data-dk-collapsed] .dk-side { width: 288px; }
  html[data-dk-collapsed] .dk-brand-text, html[data-dk-collapsed] .dk-search-input, html[data-dk-collapsed] .dk-item-lbl, html[data-dk-collapsed] .dk-count, html[data-dk-collapsed] .dk-eyebrow, html[data-dk-collapsed] .dk-sec-lbl, html[data-dk-collapsed] .dk-chev, html[data-dk-collapsed] .dk-private, html[data-dk-collapsed] .dk-brand-ver, html[data-dk-collapsed] .dk-results { display: revert !important; }
  html[data-dk-collapsed] .dk-sec.open .dk-sec-body { display: block !important; }
  html[data-dk-collapsed] .dk-kbd { display: none !important; }
  html[data-dk-collapsed] .dk-brand { flex-direction: row; height: var(--dk-top-h); padding: 0 12px 0 14px; }
  html[data-dk-collapsed] .dk-search { margin: 12px 12px 6px; justify-content: flex-start; }
  html[data-dk-collapsed] .dk-search-ic { position: absolute; width: auto; height: auto; padding: 0; pointer-events: none; }
  html[data-dk-collapsed] .dk-item, html[data-dk-collapsed] .dk-sec-head { width: 100%; margin: 0; padding: 0 10px; justify-content: flex-start; }
  html[data-dk-collapsed] .dk-sec-head { padding: 0 8px 0 6px; }
  html[data-dk-collapsed] .dk-foot-row { flex-direction: row; }
  html[data-dk-collapsed] .dk-primary { display: block; padding: 4px 8px 6px; max-height: 38vh; overflow-y: auto; }
  html[data-dk-collapsed] .dk-mini-tog { display: grid !important; }
  html[data-dk-collapsed] .dk-mini[data-mini="recent"] { display: block !important; }
  html[data-dk-collapsed] .dk-mini.open > .dk-mini-body { display: block !important; }
  html[data-dk-collapsed] .dk-mini > .dk-item { padding: 0 34px 0 10px; }
  .dk-collapse { display: none; }
  .dk-overlay { position: fixed; inset: 0; z-index: 115; background: rgba(6, 8, 12, .55); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  .dk-overlay.on { opacity: 1; pointer-events: auto; }
  .dk-menu { display: grid; }
  .dk-topbar { padding: 0 14px 0 10px; gap: 10px; }
  .dk-crumb { display: none; }
  .dk-topbtn span { display: none; }
  .dk-topbtn { padding: 0 9px; }
  .dk-top-right { gap: 6px; }
  .dk-lang-code { display: none; }
  .dk-lang-btn { padding: 0; width: 34px; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .dk-side, .dk-side.open, body, .dk-tile, .dk-tile-wrap .home-card-star, .dk-chev, .dk-overlay, .dk-mini-tog .dk-chev { transition: none; }
}

/* ---- legacy-install migration banner (desk.js legacyBanner) ---- */
.dk-migrate { display: flex; gap: 14px; align-items: flex-start; margin: 16px 24px 0; padding: 14px 16px; border: 1px solid var(--accent); border-radius: 12px; background: var(--accent-pale); color: var(--ink); font-family: var(--font-ui); }
.dk-migrate-ic { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent); color: #fff; }
.dk-migrate-body { min-width: 0; flex: 1; }
.dk-migrate-body b { display: block; font-size: 14.5px; margin-bottom: 2px; }
.dk-migrate-body p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--ink-soft); }
.dk-migrate-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.dk-migrate-btn { font: inherit; font-size: 13px; font-weight: 600; border-radius: 8px; padding: 7px 12px; cursor: pointer; border: 1px solid var(--border); background: var(--panel); color: var(--ink); }
.dk-migrate-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.dk-migrate-btn.primary:disabled { opacity: .7; cursor: default; }
.dk-migrate-btn.ghost { background: transparent; }
.dk-migrate-steps { margin: 10px 0 0; padding-left: 20px; font-size: 13px; line-height: 1.55; color: var(--ink); }
.dk-migrate-note { margin-top: 8px !important; font-size: 12.5px !important; }
@media (max-width: 760px) { .dk-migrate { margin: 12px 12px 0; } }

/* ---- a tool's own app (/app/<id>/ — desk-boot.js sets html[data-dk-single]) ----------------
   The same page as the Workspace with one tool in it: no sidebar, no crumb, no Favourites, and a
   Docs page that is this tool's guide alone. The top bar gains the install control and a way out to
   every other tool (the Workspace). */
html[data-dk-single] { --dk-w: 0px; }
html[data-dk-single] body { padding-left: 0; }
html[data-dk-single] .dk-side, html[data-dk-single] .dk-overlay, html[data-dk-single] .dk-menu,
html[data-dk-single] .dk-crumb, html[data-dk-single] #dk-fav, html[data-dk-single] .dk-docs-nav,
html[data-dk-single] .dk-migrate { display: none !important; }
html[data-dk-single] .dk-docs { grid-template-columns: minmax(0, 1fr); }
.dk-single { display: none; }
html[data-dk-single] .dk-single { display: flex; align-items: center; gap: 8px; }
.dk-single-install { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: #fff; font: 600 12.5px var(--font-ui); cursor: pointer; white-space: nowrap; }
.dk-single-install:hover { filter: brightness(1.06); }
.dk-single-install:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dk-single-install[disabled] { background: var(--panel); color: var(--ink-soft); border-color: var(--border); cursor: default; filter: none; }
.dk-single-install[hidden] { display: none; }
.dk-single-install.dk-pulse { animation: dk-pulse 1.4s ease-out 3; }
@keyframes dk-pulse { 0% { box-shadow: 0 0 0 0 rgba(226, 54, 77, .55); } 100% { box-shadow: 0 0 0 12px rgba(226, 54, 77, 0); } }
@media (max-width: 900px) { .dk-single-install span { display: none; } .dk-single-install { padding: 0 9px; } }
@media (prefers-reduced-motion: reduce) { .dk-single-install.dk-pulse { animation: none; } }
