/* ClyDoc desktop app layout (active only when <html> has .app-desktop; see js/desktop-boot.js) */
.app-desktop {
  --bg: #26272f;
  --bg-2: #1e1f25;
  --card: #31323e;
  --card-2: #393a48;
  --line: #3b3d4c;
  --line-2: #4b4d60;
  --brand: #7c5cf6;
  --brand-600: #6a4ae6;
  --brand-700: #5b3dd2;
  --glow: #a78bfa;
  --sky: #c4b5fd;
  --text: #f3f3f7;
  --muted: #9b9daf;
  --dim: #6e7084;
  --display: 'Segoe UI Variable Display', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --body: 'Segoe UI Variable Text', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --r-lg: 24px;
  --r-md: 16px;
  --dk-side: 248px;
  --dk-gap: 28px;
  --dk-peach: #f8a07e;
  --dk-purple: #7c5cf6;
  --dk-pink: #f472b6;
  --dk-track: #45475a;
  --head-h: 0px;
}
.app-desktop body { background: var(--bg); background-image: none; font-family: var(--body); }

/* Website chrome that the app replaces */
.app-desktop .topbar,
.app-desktop .foot,
.app-desktop .ambient,
.app-desktop .skip,
.app-desktop [href^="#/blog"],
.app-desktop [data-page="blog"],
.app-desktop [href*="tab=blog"],
.app-desktop [data-page="home"] > :not(.dk-dash) { display: none !important; }

/* Site accents re-coloured for the app theme */
.app-desktop .admin-tabs .on { background: var(--dk-purple); color: #fff; border-color: transparent; }

/* ---------- Sidebar ---------- */
.dk-side {
  position: fixed; inset: 0 auto 0 0; width: var(--dk-side); z-index: 40;
  display: flex; flex-direction: column; gap: 14px;
  padding: 26px 16px 18px; background: var(--bg-2);
  border-radius: 0 26px 26px 0; box-shadow: 8px 0 30px rgba(0, 0, 0, 0.25);
}
.dk-logo { display: flex; align-items: center; gap: 10px; padding: 0 14px 10px; }
.dk-logo img { height: 34px; width: auto; }
.dk-logo .dk-word { height: auto; width: 138px; max-width: calc(100% - 50px); }
.dk-nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; padding-right: 2px; scrollbar-width: thin; }
.dk-sec { margin: 12px 14px 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); display: flex; align-items: center; gap: 8px; }
.dk-pro { font-size: 9.5px; letter-spacing: 0.06em; padding: 2px 6px; border-radius: 5px; background: rgba(124, 92, 246, 0.25); color: var(--sky); }
.dk-item {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 8.5px 14px; border: 0; border-radius: 12px; background: none;
  color: var(--muted); font: 500 13.5px/1.2 var(--body); text-align: left; text-decoration: none; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.dk-item svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dk-item:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.dk-item.on { color: #fff; background: var(--dk-purple); box-shadow: 0 8px 22px rgba(124, 92, 246, 0.35); }
.dk-item[hidden] { display: none; }
.dk-badge { margin-left: auto; min-width: 20px; padding: 2px 6px; border-radius: 6px; background: var(--dk-purple); color: #fff; font-size: 11px; font-weight: 700; text-align: center; }
.dk-item.on .dk-badge { background: rgba(255, 255, 255, 0.25); }
.dk-badge[hidden] { display: none; }
.dk-item:focus-visible, .dk-user:focus-visible, .dk-card:focus-visible, .dk-search:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }

.dk-user { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; text-decoration: none; color: var(--text); background: rgba(255, 255, 255, 0.03); }
.dk-user:hover { background: rgba(255, 255, 255, 0.07); }
.dk-user:empty { display: none; }
.dk-av { width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--card-2); color: var(--text); font-weight: 700; font-size: 15px; object-fit: cover; position: relative; }
.dk-user-t { display: flex; flex-direction: column; min-width: 0; }
.dk-user-t b { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dk-user-t small { color: var(--dim); font-size: 12px; }

/* ---------- Main area and header ---------- */
.app-desktop main { margin-left: var(--dk-side); padding: 0 var(--dk-gap) 48px; min-height: 100vh; }
.app-desktop .announce-bar, .app-desktop .verify-bar { margin-left: var(--dk-side); }
.app-desktop .wrap { max-width: 1320px; padding-left: 0; padding-right: 0; }
.app-desktop .page { padding-top: 6px; }
.dk-top { max-width: 1320px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 30px 0 24px; }
.dk-hello { margin: 0 0 4px; color: var(--muted); font-size: 15px; }
.dk-title { margin: 0; font: 600 30px/1.15 var(--display); letter-spacing: -0.01em; color: var(--text); }
.dk-title.sm { display: none; }   /* inner pages show their own heading */
.dk-head:has(.dk-title.sm) .dk-hello { margin: 0; font-size: 16px; color: var(--text); font-weight: 600; }
.dk-search {
  display: flex; align-items: center; gap: 10px; min-width: 240px; padding: 11px 16px;
  border: 0; border-radius: 999px; background: var(--card); color: var(--dim); font: 500 13px var(--body); cursor: pointer;
}
.dk-search span { flex: 1; text-align: left; }
.dk-search svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; }
.dk-search kbd { font: 600 10px var(--body); padding: 2px 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.06); color: var(--dim); }
.dk-search:hover { color: var(--text); }

/* Signed-out: centred forms without the sidebar */
.dk-guest .dk-side, .dk-guest .dk-top { display: none; }
.app-desktop .dk-guest main, .dk-guest main { margin-left: 0; }
.dk-guest .announce-bar, .dk-guest .verify-bar { margin-left: 0; }

/* ---------- Dashboard ---------- */
.dk-dash { max-width: 1320px; margin: 0 auto; }
.dk-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--dk-gap); align-items: start; }
.dk-main { display: grid; gap: var(--dk-gap); }
.dk-aside { display: grid; gap: var(--dk-gap); }
.dk-card { background: var(--card); border-radius: var(--r-lg); padding: 26px 28px; position: relative; }
.dk-card[data-href] { cursor: pointer; transition: transform 0.15s, background 0.15s; }
.dk-card[data-href]:hover { background: var(--card-2); transform: translateY(-2px); }
.dk-k { margin: 0 0 6px; color: var(--muted); font-size: 13px; }
.dk-big { display: block; font: 700 40px/1.1 var(--display); color: var(--text); }
.dk-big small, .dk-mid small { font-size: 0.45em; font-weight: 500; color: var(--muted); margin-left: 6px; }

.dk-score { display: flex; align-items: center; justify-content: space-between; gap: 30px; }
.dk-score-l { flex: 1; min-width: 0; }
.dk-legend { list-style: none; margin: 26px 0 0; padding: 0; display: grid; gap: 16px; max-width: 380px; }
.dk-legend li { display: grid; grid-template-columns: 1fr 48px 90px; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.dk-legend b { color: var(--text); font-weight: 600; text-align: right; }
.dk-donut { width: 190px; height: 190px; flex: none; }
.dk-donut-v { fill: var(--text); font: 700 24px var(--display); }
.dk-donut-k { fill: var(--muted); font: 500 11px var(--body); }

.dk-bar { display: block; height: 8px; border-radius: 99px; background: var(--dk-track); overflow: hidden; }
.dk-bar.sm { height: 7px; }
.dk-bar i { display: block; height: 100%; border-radius: inherit; background: var(--c, var(--dk-purple)); }

.dk-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--dk-gap); }
.dk-stat { padding: 22px 24px 18px; }
.dk-mid { display: block; font: 700 30px/1.15 var(--display); color: var(--text); }
.dk-delta { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; }
.dk-spark { display: block; width: 100%; height: 48px; margin-top: 18px; }

.dk-banner {
  display: flex; align-items: center; gap: 24px; padding: 26px 64px 26px 30px; border-radius: var(--r-lg); position: relative; overflow: hidden;
  background: linear-gradient(115deg, #6d4ef0 0%, #7c5cf6 45%, #8f74f8 100%);
}
.dk-banner::after { content: ''; position: absolute; right: -40px; bottom: -70px; width: 360px; height: 160px; border-radius: 50%; background: rgba(255, 255, 255, 0.12); pointer-events: none; }
.dk-banner p { margin: 0; flex: 1; color: #fff; font: 700 17px/1.4 var(--body); max-width: 520px; position: relative; z-index: 1; }
.dk-btn { position: relative; z-index: 1; padding: 11px 26px; border: 0; border-radius: 12px; background: #fff; color: #1e1f25; font: 700 14px var(--body); text-decoration: none; cursor: pointer; white-space: nowrap; }
.dk-btn:hover { background: #f1edff; }
.dk-x { position: absolute; top: 14px; right: 14px; z-index: 1; width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: #fff; cursor: pointer; display: grid; place-items: center; }
.dk-x svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.dk-x:hover { background: rgba(255, 255, 255, 0.15); }

.dk-cat { padding: 24px 24px 26px; }
.dk-cat-h { display: flex; justify-content: space-between; gap: 14px; }
.dk-cat h3 { margin: 0; font: 700 17px/1.25 var(--display); color: var(--text); }
.dk-cat p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.dk-cat-ic { width: 44px; height: 44px; flex: none; border-radius: 12px; background: var(--bg-2); display: grid; place-items: center; color: var(--c); }
.dk-cat-ic svg { width: 20px; height: 20px; fill: currentColor; stroke: currentColor; stroke-width: 1.2; stroke-linejoin: round; }
.dk-pct { display: block; margin: 26px 0 10px; color: var(--text); font-size: 14px; font-weight: 600; }

@media (max-width: 1180px) {
  .dk-grid { grid-template-columns: 1fr; }
  .dk-aside { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .app-desktop { --dk-side: 78px; --dk-gap: 18px; }
  .dk-side { padding: 20px 10px; }
  .dk-logo .dk-word, .dk-item span, .dk-sec, .dk-user-t, .dk-badge { display: none; }
  .dk-item { justify-content: center; padding: 11px; }
  .dk-logo { justify-content: center; padding: 0 0 10px; }
  .dk-user { justify-content: center; padding: 8px; }
  .dk-stats, .dk-aside { grid-template-columns: 1fr; }
  .dk-score { flex-direction: column; align-items: stretch; }
  .dk-donut { align-self: center; }
  .dk-search { min-width: 0; }
  .dk-search span, .dk-search kbd { display: none; }
}
@media (prefers-reduced-motion: reduce) { .dk-card[data-href] { transition: none; } .dk-card[data-href]:hover { transform: none; } }
