/* =====================================================================
   NAIVAI intranet — same design tokens as the NAIVAI portal
   (portal/src/assets/css/tailwind/palette.css + theme.css)
   ===================================================================== */

:root,
[data-theme='light'] {
  --amber-100: #fbe8d9;
  --amber-500: #e89b6c;
  --amber-700: #c77f4f;
  --amber-900: #6b3d14;
  --indigo-100: #eceaf6;
  --indigo-300: #8983d6;
  --indigo-500: #3d35a0;

  --bg-default: #faf5eb;
  --bg-surface: #fdfcf8;
  --bg-surface-2: #f5ede0;
  --bg-inset: #0f0c1d14;
  --bg-hover: #8983d40f;
  --bg-accent: #e89b6c1a;
  --bg-accent-muted: #e89b6c2e;
  --bg-indigo: #3d35a01f;
  --bg-info: #4a6fa51f;
  --bg-pending: #f48c351f;
  --bg-success: #5a8f6b1f;

  --border-default: #2a26201a;
  --border-strong: #2a262033;
  --border-subtle: #2a26200f;
  --border-accent: #e89b6c4d;

  --text-primary: #2a2620;
  --text-muted: #6b6355;
  --text-faint: #9a9182;
  --text-accent: var(--amber-500);

  --status-success: #5a8f6b;
  --status-info: #4a6fa5;
  --status-pending: #f48c35;
  --status-indigo: #3d35a0;

  --code-bg: #f5ede0;
  --shadow: 0 1px 2px #2a26200a, 0 12px 32px -16px #2a262026;
  --shadow-hover: 0 4px 10px #2a262012, 0 22px 44px -18px #2a262033;
}

[data-theme='dark'] {
  --bg-default: #0f0c2e;
  --bg-surface: #15123a;
  --bg-surface-2: #221c53;
  --bg-inset: #0f0c1d66;
  --bg-hover: #8983d414;
  --bg-accent: #e89b6c14;
  --bg-accent-muted: #e89b6c24;
  --bg-indigo: #3d35a029;
  --bg-info: #4a6fa529;
  --bg-pending: #f48c3529;
  --bg-success: #5a8f6b29;

  --border-default: #8983d62e;
  --border-strong: #8983d652;
  --border-subtle: #8983d61a;
  --border-accent: #e89b6c33;

  --text-primary: #f2f0fa;
  --text-muted: #9f9ac4;
  --text-faint: #6b679a;

  --status-success: #7fb890;
  --status-info: #7f9fd1;
  --status-pending: #f8a761;
  --status-indigo: #8983d6;

  --code-bg: #0f0c2e;
  --shadow: 0 1px 2px #00000040, 0 14px 34px -16px #00000080;
  --shadow-hover: 0 4px 12px #00000059, 0 24px 46px -18px #000000a6;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }

body {
  margin: 0;
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  font-size: 16px;
  line-height: 24px;
  color: var(--text-primary);
  background: var(--bg-default);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@media (prefers-reduced-motion: no-preference) {
  body, .sidebar, .card, .nav-item, .theme-toggle, .article {
    transition: background-color .3s ease, border-color .3s ease, color .3s ease, box-shadow .2s ease, transform .2s ease;
  }
}

/* ---- Shell: sidebar + content, like the portal ---- */
.shell { display: flex; min-height: 100dvh; }

.sidebar {
  position: sticky; top: 0;
  display: flex; flex-direction: column; justify-content: space-between;
  width: 250px; 
  height: 100dvh; 
  flex: none;
  padding: 16px ;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
}
.sidebar-top { display: flex; flex-direction: column; gap: 16px; }

.logo { display: block; padding: 13px 0; }
.logo img { display: block; width: 89px; height: 35px; }
.logo .on-dark { display: none; }
[data-theme='dark'] .logo .on-light { display: none; }
[data-theme='dark'] .logo .on-dark { display: block; }

.divider { height: 1px; background: var(--border-subtle); }

.label {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px; line-height: 18px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-faint);
  margin: 0;
}

.nav { display: flex; flex-direction: column; gap: 8px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; border-radius: 8px;
  border: 1px solid transparent;
  color: var(--text-muted); text-decoration: none;
  font-size: 15px; line-height: 24px;
}
.nav-item svg { width: 15px; height: 15px; flex: none; stroke-width: 1.6; }
.nav-item:hover { background: var(--bg-hover); }
.nav-item:hover svg { color: var(--text-accent); }
.nav-item.is-active { background: var(--bg-accent); border-color: var(--border-accent); color: var(--text-primary); }
.nav-item.is-active svg { color: var(--text-accent); }

/* "Documentatie" group with the pages folded underneath */
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-toggle { cursor: pointer; list-style: none; user-select: none; }
.nav-group-toggle::-webkit-details-marker { display: none; }
.nav-group-toggle span:first-of-type { flex: 1; }
.nav-group.has-current > .nav-group-toggle { color: var(--text-primary); }
.nav-group.has-current > .nav-group-toggle svg { color: var(--text-accent); }
.nav-count {
  min-width: 22px; padding: 0 6px; border-radius: 9999px; text-align: center;
  font: 400 11px/18px 'JetBrains Mono', ui-monospace, monospace;
  background: var(--bg-accent-muted); color: var(--text-primary);
}
.nav-item .nav-chevron { width: 14px; height: 14px; stroke-width: 2; color: var(--text-faint); transition: transform .2s ease; }
.nav-group[open] > .nav-group-toggle .nav-chevron { transform: rotate(180deg); }

.nav-sub { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 4px 23px; padding-left: 12px; border-left: 1px solid var(--border-default); }
.nav-subitem {
  display: block; padding: 6px 10px; border-radius: 6px;
  font-size: 14px; line-height: 20px; color: var(--text-muted); text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav-subitem:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-subitem.is-active { background: var(--bg-accent); color: var(--text-primary); box-shadow: inset 2px 0 0 var(--amber-500); }
.nav-empty { padding: 6px 10px; font-size: 13px; color: var(--text-faint); }
@media (prefers-reduced-motion: no-preference) {
  .nav-group[open] .nav-sub { animation: navOpen .18s ease; }
}
@keyframes navOpen { from { opacity: 0; transform: translateY(-4px); } }

.sidebar-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border-subtle); }
.sidebar-bottom .label { padding-left: 4px; }

.theme-toggle {
  width: 36px; height: 36px; border-radius: 8px;
  display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--border-default); background: var(--bg-surface);
  color: var(--text-muted);
}
.theme-toggle:hover { color: var(--text-accent); border-color: var(--border-accent); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .sun { display: none; }
[data-theme='dark'] .theme-toggle .sun { display: block; }
[data-theme='dark'] .theme-toggle .moon { display: none; }

.content { flex: 1; min-width: 0; padding: 40px 48px 72px; }
.content-inner { max-width: 1040px; margin: 0 auto; }

/* ---- Page head ---- */
.page-head { margin-bottom: 32px; }
.page-head h1 {
  font-family: 'Nunito Variable', 'Nunito', ui-sans-serif, system-ui, sans-serif;
  font-weight: 800; font-size: 32px; line-height: 40px; letter-spacing: -.01em;
  margin: 0 0 6px;
}
.page-head p { margin: 0; color: var(--text-muted); font-size: 15px; }

.crumbs { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.crumbs a { color: var(--text-muted); text-decoration: none; }
.crumbs a:hover { color: var(--text-accent); }
.crumbs svg { width: 12px; height: 12px; color: var(--text-faint); }

/* ---- Categories + cards ---- */
.category { margin-bottom: 32px; }
@media (prefers-reduced-motion: no-preference) {
  .category { opacity: 0; transform: translateY(8px); animation: rise .45s ease forwards; }
  .category:nth-child(2) { animation-delay: .05s; }
  .category:nth-child(3) { animation-delay: .1s; }
  .category:nth-child(4) { animation-delay: .15s; }
  .category:nth-child(5) { animation-delay: .2s; }
}
@keyframes rise { to { opacity: 1; transform: none; } }

.cat-title { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.cat-title svg { width: 14px; height: 14px; color: var(--text-faint); }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

.card {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  padding: 20px 22px; border-radius: 16px;
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow);
  color: inherit; text-decoration: none; overflow: hidden;
}
.card::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(173deg, #e89b6c14 0%, #e89b6c05 70%);
  opacity: 0; transition: opacity .25s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--border-accent); box-shadow: var(--shadow-hover); }
.card:hover::before { opacity: 1; }
.card:focus-visible { outline: 2px solid var(--indigo-500); outline-offset: 2px; }

.card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: relative; }
.card-name {
  font-family: 'Nunito Variable', 'Nunito', ui-sans-serif, system-ui, sans-serif;
  font-weight: 700; font-size: 17px; line-height: 24px;
}
.card-desc { position: relative; margin: 0; font-size: 13px; line-height: 20px; color: var(--text-muted); }
.card-foot {
  position: relative; margin-top: auto;
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--text-muted);
}
.card-foot svg { width: 14px; height: 14px; transition: transform .2s ease; }
.card:hover .card-foot { color: var(--text-accent); }
.card:hover .card-foot svg { transform: translateX(3px); }

/* Status pill, same shape as the portal's status badges */
.pill {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 2px 10px; border-radius: 9999px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px; line-height: 18px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.live { background: var(--bg-success); color: var(--status-success); }
.pill.staging { background: var(--bg-pending); color: var(--status-pending); }
.pill.external { background: var(--bg-indigo); color: var(--status-indigo); }
.pill.docs { background: var(--bg-accent-muted); color: var(--amber-700); }
[data-theme='dark'] .pill.docs { color: var(--amber-500); }
@media (prefers-reduced-motion: no-preference) {
  .pill.live::before { animation: pulse 2s ease-in-out infinite; }
}
@keyframes pulse { 50% { opacity: .45; } }

/* ---- Documentation page ---- */
.doc { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 32px; align-items: start; }

.toc { position: sticky; top: 24px; font-size: 13px; line-height: 18px; }
.toc .label { margin-bottom: 10px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border-default); }
.toc a {
  display: block; margin-left: -1px; padding: 5px 0 5px 14px;
  border-left: 2px solid transparent;
  color: var(--text-muted); text-decoration: none;
}
.toc a:hover { color: var(--text-primary); }
.toc a.is-active { color: var(--text-primary); border-left-color: var(--amber-500); font-weight: 600; }
.toc .lvl-3 a { padding-left: 26px; font-size: 12.5px; }

.article {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: 16px; box-shadow: var(--shadow);
  padding: 36px 44px; min-width: 0;
}

.prose { font-size: 15px; line-height: 26px; }
.prose > :first-child { margin-top: 0; }
.prose h2 {
  font-family: 'Nunito Variable', 'Nunito', ui-sans-serif, system-ui, sans-serif;
  font-weight: 800; font-size: 22px; line-height: 30px;
  margin: 40px 0 12px; padding-top: 24px; border-top: 1px solid var(--border-subtle);
}
.prose > h2:first-child { border-top: 0; padding-top: 0; }
.prose h3 {
  font-family: 'Nunito Variable', 'Nunito', ui-sans-serif, system-ui, sans-serif;
  font-weight: 700; font-size: 17px; margin: 28px 0 8px;
}
.prose p { margin: 0 0 14px; }
.prose ul, .prose ol { margin: 0 0 14px; padding-left: 22px; }
.prose li { margin: 4px 0; }
.prose li::marker { color: var(--text-accent); }
.prose a { color: var(--text-primary); text-decoration: underline; text-decoration-color: var(--amber-500); text-underline-offset: 3px; }
.prose a:hover { color: var(--text-accent); }
.prose strong { font-weight: 600; }
.prose code {
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: .84em;
  background: var(--bg-accent); color: var(--text-primary);
  border: 1px solid var(--border-accent); border-radius: 4px; padding: 1px 5px;
}
.prose pre {
  position: relative; margin: 0 0 16px; padding: 16px 18px; overflow-x: auto;
  background: var(--code-bg); border: 1px solid var(--border-subtle); border-radius: 8px;
}
.prose pre code { background: none; border: 0; padding: 0; font-size: 13px; line-height: 21px; }
.copy {
  position: absolute; top: 8px; right: 8px;
  font: 700 10px/18px 'JetBrains Mono', ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-muted); background: var(--bg-surface);
  border: 1px solid var(--border-default); border-radius: 6px; padding: 3px 8px;
  cursor: pointer; opacity: 0; transition: opacity .15s, color .15s;
}
.prose pre:hover .copy, .copy:focus-visible { opacity: 1; }
.copy:hover { color: var(--text-accent); }
.copy.done { opacity: 1; color: var(--status-success); }

.table-wrap { overflow-x: auto; margin: 0 0 16px; border: 1px solid var(--border-subtle); border-radius: 8px; }
.prose table { border-collapse: collapse; width: 100%; font-size: 14px; line-height: 20px; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--border-subtle); }
.prose th {
  background: var(--bg-surface-2); color: var(--text-muted);
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.prose tr:last-child td { border-bottom: 0; }
.prose blockquote { margin: 0 0 16px; padding: 12px 16px; border-left: 3px solid var(--amber-500); background: var(--bg-accent); border-radius: 0 8px 8px 0; color: var(--text-muted); }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose hr { border: 0; border-top: 1px solid var(--border-subtle); margin: 28px 0; }

/* ---- Buttons, fields, panels (editor) ---- */
.nav-item--small { padding: 6px 12px; font-size: 14px; flex: 1; }
.page-head--row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.button, .button-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 8px; cursor: pointer;
  font: 600 14px/1 'Inter', ui-sans-serif, system-ui, sans-serif; text-decoration: none; white-space: nowrap;
}
.button { background: var(--amber-500); color: #211b4d; border: 1px solid var(--amber-500); }
.button:hover { background: var(--amber-700); border-color: var(--amber-700); }
.button:disabled { opacity: .55; cursor: progress; }
.button-ghost { background: var(--bg-surface); color: var(--text-primary); border: 1px solid var(--border-default); }
.button-ghost:hover { border-color: var(--border-accent); color: var(--text-accent); }
.button:focus-visible, .button-ghost:focus-visible, .input:focus-visible, .md-input:focus-visible { outline: 2px solid var(--indigo-500); outline-offset: 1px; }

.panel { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 16px; box-shadow: var(--shadow); padding: 28px 32px; }
.panel-title { font-family: 'Nunito Variable', 'Nunito', ui-sans-serif, system-ui, sans-serif; font-weight: 800; font-size: 20px; line-height: 28px; margin: 0 0 6px; }
.panel-text { margin: 0 0 18px; color: var(--text-muted); font-size: 14px; }
.login { max-width: 440px; }
.login-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.login-form .field { flex: 1; min-width: 200px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field--inline { flex-direction: row; align-items: center; gap: 10px; }
.field-hint { font-size: 12px; line-height: 18px; color: var(--text-faint); }
.field-hint code { font-family: 'JetBrains Mono', ui-monospace, monospace; }
.input {
  height: 40px; padding: 0 12px; border-radius: 8px; width: 100%;
  background: var(--bg-default); color: var(--text-primary);
  border: 1px solid var(--border-default); font: 400 14px/20px 'Inter', ui-sans-serif, system-ui, sans-serif;
}
.input:hover { border-color: var(--border-strong); }
select.input { width: auto; min-width: 200px; padding-right: 28px; cursor: pointer; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }
.form-error { margin: 10px 0 0; min-height: 20px; font-size: 13px; color: #b85450; }

/* ---- Editor layout ---- */
.content--wide .content-inner { max-width: 1400px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar-spacer { flex: 1; }
.save-state { color: var(--text-faint); }
.save-state--dirty { color: var(--status-pending); }
.save-state--ok { color: var(--status-success); }

.meta-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 16px; margin-bottom: 16px; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.pane { display: flex; flex-direction: column; min-width: 0; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.pane-head { display: flex; justify-content: space-between; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border-subtle); background: var(--bg-surface-2); }
.pane-hint { letter-spacing: .04em; text-transform: none; font-weight: 400; }
.md-input {
  flex: 1; min-height: 64vh; resize: vertical; border: 0; margin: 0; padding: 18px 20px;
  background: transparent; color: var(--text-primary);
  font: 400 13.5px/22px 'JetBrains Mono', ui-monospace, monospace; tab-size: 2;
}
.preview { padding: 22px 26px; overflow-y: auto; max-height: 72vh; }
.preview-title { font-family: 'Nunito Variable', 'Nunito', ui-sans-serif, system-ui, sans-serif; font-weight: 800; font-size: 26px; line-height: 34px; margin: 0 0 18px; }

.dialog { border: 1px solid var(--border-subtle); border-radius: 16px; padding: 26px 28px; width: min(480px, calc(100vw - 32px)); background: var(--bg-surface); color: var(--text-primary); box-shadow: var(--shadow-hover); }
.dialog::backdrop { background: #0f0c2e66; backdrop-filter: blur(2px); }
.dialog form { display: flex; flex-direction: column; gap: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }

@media (max-width: 1100px) {
  .split, .meta-grid { grid-template-columns: minmax(0, 1fr); }
  .md-input { min-height: 40vh; }
}

/* ---- Editor: tabs ---- */
.tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--border-default); }
.tab {
  margin-bottom: -1px; padding: 10px 16px; cursor: pointer;
  background: none; border: 0; border-bottom: 2px solid transparent;
  font: 600 14px/20px 'Inter', ui-sans-serif, system-ui, sans-serif; color: var(--text-muted);
}
.tab:hover { color: var(--text-primary); }
.tab.is-active { color: var(--text-primary); border-bottom-color: var(--amber-500); }
.tab:focus-visible { outline: 2px solid var(--indigo-500); outline-offset: -2px; }

/* ---- Editor: home page (categories + cards) ---- */
.home-editor { padding: 16px; display: flex; flex-direction: column; gap: 14px; max-height: 72vh; overflow-y: auto; }
.he-cat { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 12px; background: var(--bg-surface-2); border: 1px solid var(--border-subtle); }
.he-cat-head { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.he-grow { flex: 1; min-width: 160px; }
.he-actions { display: flex; gap: 6px; }
.he-card { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 10px; background: var(--bg-surface); border: 1px solid var(--border-subtle); }
.he-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.he-wide { grid-column: 1 / -1; }
.he-card-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.he-add { align-self: flex-start; height: 34px; }
.he-card .input, .he-cat .input { height: 36px; background: var(--bg-surface); }
.input--small { width: auto; min-width: 0; height: 32px !important; font-size: 13px; }

.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--amber-500); }

.icon-btn {
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer;
  display: inline-grid; place-items: center; font-size: 14px; line-height: 1;
  background: var(--bg-surface); color: var(--text-muted); border: 1px solid var(--border-default);
}
.icon-btn:hover:not(:disabled) { color: var(--text-accent); border-color: var(--border-accent); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn--danger:hover:not(:disabled) { color: #b85450; border-color: #b8525199; }

.cat-empty { margin: 0; font-size: 13px; color: var(--text-faint); }
.preview--home { padding: 22px 24px; }
.preview--home .grid { grid-template-columns: minmax(0, 1fr); }
.preview--home .category { animation: none; opacity: 1; transform: none; }
.preview--home .card { cursor: default; }

/* Task-list checkboxes in documentation (- [x] ...) */
.prose li:has(> input[type='checkbox']) { list-style: none; margin-left: -20px; }
.prose li > input[type='checkbox'] { margin: 0 8px 0 0; accent-color: var(--amber-500); vertical-align: -2px; }

/* ---- Loading / error state while the .md file is fetched ---- */
.doc-status { margin: 0; color: var(--text-muted); }
.doc-status--error { color: #b85450; }

/* ---- Downloads above a document ---- */
.downloads { display: grid; gap: 12px; margin-bottom: 16px; }
.download {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px; border-radius: 16px;
  background: var(--bg-accent); border: 1px solid var(--border-accent);
  color: inherit; text-decoration: none;
}
.download:hover { background: var(--bg-accent-muted); transform: translateY(-1px); }
.download:focus-visible { outline: 2px solid var(--indigo-500); outline-offset: 2px; }
.download-icon {
  flex: none; width: 40px; height: 40px; border-radius: 9999px;
  display: grid; place-items: center;
  background: var(--amber-500); color: #211b4d;
}
.download-icon svg { width: 18px; height: 18px; }
.download-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.download-title { font-family: 'Nunito Variable', 'Nunito', ui-sans-serif, system-ui, sans-serif; font-weight: 700; font-size: 16px; line-height: 22px; }
.download-desc { font-size: 13px; line-height: 19px; color: var(--text-muted); }
.download-meta { flex: none; }
@media (max-width: 520px) {
  .download { flex-wrap: wrap; }
  .download-meta { width: 100%; padding-left: 56px; }
}

.foot-note { margin: 14px 4px 0; font-size: 12px; color: var(--text-faint); }
.foot-note code { font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* ---- Smaller screens: sidebar becomes a top bar ---- */
@media (max-width: 1100px) {
  .doc { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; order: -1; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 16px; padding: 16px 18px; }
}
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar {
    position: sticky; top: 0; z-index: 20;
    width: 100%; height: auto; flex-direction: row; align-items: center;
    padding: 6px 16px; border-right: 0; border-bottom: 1px solid var(--border-subtle);
  }
  .sidebar-top { flex-direction: row; align-items: center; gap: 12px; min-width: 0; }
  .sidebar .divider, .sidebar .label, .sidebar-bottom .label { display: none; }
  .logo { padding: 6px 0; }
  .nav { flex-direction: row; gap: 4px; }
  /* The group becomes a dropdown under the top bar */
  .nav-group { position: relative; }
  .nav-group .nav-count { display: none; }
  .nav-sub {
    position: absolute; top: calc(100% + 6px); left: 0; z-index: 40;
    min-width: 220px; max-width: calc(100vw - 32px); margin: 0; padding: 6px;
    background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: 12px;
    box-shadow: var(--shadow-hover);
  }
  .nav-item { padding: 6px 10px; font-size: 14px; white-space: nowrap; }
  .sidebar-bottom { border-top: 0; padding-top: 0; }
  .content { padding: 24px 16px 56px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .article { padding: 22px 18px; }
  .page-head h1 { font-size: 26px; line-height: 32px; }
}
@media (max-width: 520px) {
  .nav-item span { display: none; }
}
