/* KodeMed Downloads – style.css */

:root {
  --bg: #f8fafc;
  --bg2: #f1f5f9;
  --card: #ffffff;
  --card2: #f1f5f9;
  --orange: #F05008;
  --orangeLight: #f26a3a;
  --green: #22c55e;
  --greenLight: #4ade80;
  --blue: #0069cd;
  --blueLight: #3387d7;
  /* --ink is the canonical name for the primary body / heading colour
     (slate-900). --white is kept as a backwards-compat alias because it
     is referenced in ~80 places across this stylesheet — the rename
     would have made this commit unreviewable. New code should prefer
     --ink. */
  --ink: #1e293b;
  --white: #1e293b;
  --gray: #556677;
  /* --grayDark used to be #6b7c8d which is 3.9:1 on white — fails WCAG AA
     for body text. Darkened to slate-600 (7.2:1) so muted text is still
     muted but actually readable. */
  --grayDark: #4b5563;
  --grayLight: #334155;
  --border: #e2e8f0;
  --radius: 8px;

  /* Type scale (modular ratio ~1.22). One scale, used everywhere — h3 must
     be visibly larger than body, not just a different colour. */
  --text-xs:    0.78rem;   /* badges, micro-labels */
  --text-sm:    0.875rem;  /* table cells, hints, sidebar L2 */
  --text-base:  1rem;      /* body */
  --text-md:    1.05rem;   /* sidebar L1, card subtitles */
  --text-lg:    1.125rem;  /* card titles (h3) */
  --text-xl:    1.375rem;  /* sub-section headings (h4 if used) */
  --text-2xl:   1.625rem;  /* section titles (h2) */

  /* One canonical font stack — kills the Trebuchet/Segoe split that
     rendered differently on Windows vs macOS. */
  --font-sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* ============================================================================
   Global accessibility floor (WCAG AA)
   ========================================================================== */

/* Keyboard focus ring — visible on EVERY focusable element except where the
   element overrides for stylistic reasons (e.g. .dl-btn already has a hover
   shadow that doubles as focus). :focus-visible avoids showing the ring on
   mouse clicks. Required: many wizard inputs explicitly set outline:none. */
:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Skip link — first focusable element on the page; jumps straight to <main>
   for keyboard / screen-reader users. Hidden visually until focused. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: 10000;
}
.skip-link:focus {
  left: 16px;
  top: 16px;
  width: auto;
  height: auto;
  padding: 0.5rem 0.9rem;
  background: var(--orange);
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Respect users who prefer reduced motion — vestibular disorder, low-spec
   devices, accessibility settings. Cuts every transition/animation to ~0. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}

/* Inline-link helpers — used to be inline style="color:#90caf9" (light blue,
   2.0:1 contrast on white, FAILS WCAG AA) or style="color:#666" (5.7:1, ok
   but not in palette). Both replaced by these classes. */
.link-blue { color: var(--blue); }
.link-blue:hover { color: var(--blueLight); }

.text-muted { color: var(--gray); }   /* 6.4:1 on white — passes AA */

/* Anchor jumps and programmatic scrolls leave a gap equal to the sticky
   header (60px) plus a small breathing margin so the section title is
   not glued to the header. Header exposes --portal-header-height via
   :root-cascading from the <header> rule below; we mirror that here. */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  background: var(--bg);
  color: var(--grayLight);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Heading defaults — every h2/h3 inherits these unless a block overrides. */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  color: var(--white);
  line-height: 1.3;
  letter-spacing: -0.01em;
}
h2 { font-size: var(--text-2xl); font-weight: 600; }
h3 { font-size: var(--text-lg);  font-weight: 600; }
h4 { font-size: var(--text-md);  font-weight: 600; }

a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header (navy bar — consistent across all kodemed.ch sites) ── */

header {
  background: #0069cd;
  padding: 0.8rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Sticky so the brand stays visible while the user scrolls — the sidebar
     anchors below it via `top: var(--portal-header-height)`. */
  position: sticky;
  top: 0;
  z-index: 100;
  /* Measured at the typical 0.8rem padding + 36px logo height; expose as a
     CSS var so the sidebar can stay aligned even if padding changes here. */
  --portal-header-height: 60px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

.header-left img {
  height: 36px;
  border-radius: 4px;
  background: #fff;
  padding: 2px;
}

.header-brand {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand-kode { color: #fff; }
.brand-med { color: #F05008; }

.header-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.header-nav a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

.header-nav a:hover { color: var(--orange); text-decoration: none; }
.header-nav-active { color: var(--orange) !important; }

.header-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.lang-switch {
  display: flex;
  gap: 0.3rem;
}

.lang-switch button {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.7);
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  transition: all 0.2s;
}

.lang-switch button:hover:not(:disabled) { border-color: #F05008; color: #F05008; }
.lang-switch button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.lang-switch button.active {
  background: #F05008;
  border-color: #F05008;
  color: #fff;
}

.header-version {
  color: rgba(255,255,255,0.55);
  font-size: 0.78rem;
  margin-left: auto;
  padding-left: 1rem;
}

/* ── Container ── */

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ── Sections ── */

section { margin-bottom: 4rem; }

.section-title {
  /* Inherits font-family from h2 default — single stack across the portal */
  font-size: var(--text-2xl);
  color: var(--white);
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* ── Tabs ── */

.tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.tab {
  /* Now rendered as <button>, so kill the default user-agent button look. */
  padding: 0.4rem 1.2rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  color: var(--gray);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  user-select: none;
  -webkit-appearance: none;
  appearance: none;
}

.tab:hover {
  background: var(--card2);
  color: var(--grayLight);
}

.tab.active {
  /* Demoted from orange to blue — orange is now reserved for the sidebar's
     "you are here" cue and primary CTAs (Download / Generate). Three
     concurrent oranges (sidebar + tabs + portal-nav) was visual noise. */
  background: var(--blue);
  color: #ffffff;
  border-color: var(--blue);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Cards ── */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--orange);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  margin-bottom: 0.8rem;
  transition: border-color 0.15s ease;
}

.card:hover { border-left-color: var(--orangeLight); }
.card.green { border-left-color: var(--green); }
.card.green:hover { border-left-color: var(--greenLight); }
.card.blue { border-left-color: var(--blue); }
.card.blue:hover { border-left-color: var(--blueLight); }

.card h3 {
  color: var(--white);
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.card-muted {
  color: var(--gray);
  font-size: 0.85rem;
}

.card-muted-spaced {
  color: var(--gray);
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
}

.card-spaced h3 { margin-top: 1rem; }
.card-spaced h3:first-child { margin-top: 0; }

.card-section { margin-top: 1rem; }

/* ── Installer CTA ── */

.installer-card {
  border-left-width: 4px;
  text-align: center;
  padding: 1.5rem 1.4rem;
}

.installer-card h3 {
  font-size: 1.15rem;
  margin-bottom: 0.3rem;
}

.installer-desc {
  color: var(--gray);
  font-size: 0.9rem;
  margin-bottom: 1.2rem;
}

.installer-btn {
  display: inline-block;
  background: var(--green);
  color: #ffffff;
  padding: 0.7rem 2.5rem;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
  border: none;
  cursor: pointer;
}

.installer-btn:hover {
  background: var(--greenLight);
  text-decoration: none;
  transform: translateY(-1px);
}

.installer-steps {
  color: var(--grayDark);
  font-size: 0.82rem;
  margin-top: 1rem;
}

.installer-note {
  color: var(--grayDark);
  font-size: 0.78rem;
  margin-top: 0.8rem;
  font-style: italic;
}

/* ── File lists ── */

.file-list { list-style: none; }

.file-list li {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.file-list li:last-child { border-bottom: none; }
.file-list .name { flex: 1; color: var(--grayLight); }

.dl-btn {
  background: var(--orange);
  color: #ffffff;
  padding: 0.45rem 1rem;
  border-radius: 6px;
  font-size: var(--text-sm);
  font-weight: 600;
  /* No more UPPERCASE / letter-spacing — sentence case is the modern default
     and reads as documentation-portal, not 2014 admin panel. */
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.dl-btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
}

.dl-btn:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }

.dl-btn.orange:hover { background: var(--orangeLight); }
.dl-btn.green { background: var(--green); }
.dl-btn.green:hover { background: var(--greenLight); }
.dl-btn.blue { background: var(--blue); }
.dl-btn.blue:hover { background: var(--blueLight); }

/* Disabled / muted variant — was misleadingly named .dl-btn-error.
   Keep .dl-btn-error as a deprecated alias so existing markup keeps working. */
.dl-btn-disabled,
.dl-btn-error {
  background: var(--grayDark);
  cursor: not-allowed;
  box-shadow: none;
}
.dl-btn-disabled:hover,
.dl-btn-error:hover { transform: none; box-shadow: none; }

/* ── Command blocks ── */

.install-cmd {
  background: #0C0E14;
  padding: 1rem 1.2rem;
  border-radius: 6px;
  font-family: 'Cascadia Code', Consolas, monospace;
  font-size: 0.82rem;
  color: var(--green);
  overflow-x: auto;
  margin-top: 0.8rem;
  border: 1px solid var(--border);
  line-height: 1.7;
}

.install-cmd.muted { color: #8b99a8; }

/* ── System requirements ── */

.sys-req {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 0.8rem;
}

.sys-req-item {
  background: var(--card2);
  padding: 0.3rem 0.8rem;
  border-radius: 4px;
  font-size: 0.78rem;
  color: var(--gray);
}

/* ── Markdown viewer ── */

.md-render {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  padding: 1.5rem;
  margin-bottom: 0.8rem;
  border-radius: var(--radius);
  line-height: 1.7;
}

.md-render h1,
.md-render h2,
.md-render h3 { color: var(--white); margin: 1rem 0 0.5rem; }

.md-render h1:first-child,
.md-render h2:first-child { margin-top: 0; }

.md-render code {
  background: #0C0E14;
  color: #c9d1d9;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-family: 'Cascadia Code', 'Fira Code', Consolas, 'Courier New', monospace;
  font-size: 0.85em;
}

.md-render pre {
  background: #0C0E14;
  color: #c9d1d9;
  padding: 1rem;
  overflow-x: auto;
  border-radius: 6px;
  margin: 0.8rem 0;
  border: 1px solid var(--border);
  font-family: 'Cascadia Mono', 'Consolas', 'Courier New', monospace;
  font-size: 0.82rem;
  line-height: 1.4;
  tab-size: 4;
  white-space: pre;
  letter-spacing: 0;
  font-variant-ligatures: none;
}

.md-render pre code { background: none; padding: 0; font-size: inherit; }

.md-render table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.8rem 0;
}

.md-render th,
.md-render td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.8rem;
  text-align: left;
}

.md-render th { background: var(--card2); color: var(--white); }

.md-render blockquote {
  border-left: 3px solid var(--orange);
  padding-left: 1rem;
  color: var(--gray);
  margin: 0.8rem 0;
}

.md-render ul,
.md-render ol { padding-left: 1.5rem; margin: 0.5rem 0; }

.md-render a { color: var(--blue); text-decoration: underline; cursor: pointer; }
.md-render a:hover { color: var(--orange); }

/* ── Details/Summary ── */

details { margin-bottom: 0.8rem; }

details summary {
  color: var(--gray);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.6rem 0;
  transition: color 0.15s;
  user-select: none;
}

details summary:hover { color: var(--grayLight); }
details[open] summary { color: var(--white); }

/* ── Badge ── */

.badge {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;             /* pill shape — modern, less "admin tag" */
  font-size: var(--text-xs);        /* 0.78rem ≈ 12.5px, above 11-px floor */
  font-weight: 600;
  vertical-align: middle;
  /* No more uppercase + tracking — sentence-case fits the documentation tone. */
}

/* Badge tints — colors aligned with brand. The orange used to be #F59100
   (Material orange 500) which competed with the brand orange #F05008. */
.badge-blue   { background: rgba(0, 105, 205, 0.12); color: var(--blue);   }
.badge-green  { background: rgba(34, 197, 94, 0.12); color: var(--green);  }
.badge-orange { background: rgba(240, 80, 8, 0.12);  color: var(--orange); }
.badge-red    { background: rgba(220, 38, 38, 0.12); color: #b91c1c;       }

/* ── Footer ── */

footer {
  text-align: center;
  padding: 1.5rem 2rem;
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
  border-top: none;
  background: #0069cd;
}

footer a { color: rgba(255,255,255,0.7); }
footer a:hover { color: #ffffff; }

.footer-links {
  margin-top: 0.5rem;
  display: flex;
  justify-content: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.impressum {
  margin-top: 0.8rem;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.5);
  line-height: 1.5;
}

.impressum strong {
  color: rgba(255,255,255,0.7);
}

/* ── Portal Navigation ── */

.portal-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 0;
  padding: 0;
  justify-content: center;
  flex-wrap: wrap;
}

.portal-nav a {
  color: var(--gray);
  padding: 0.6rem 1.2rem;
  font-size: 0.82rem;
  font-weight: 500;
  transition: all 0.15s ease;
  border-bottom: 2px solid transparent;
}

.portal-nav a:hover {
  color: var(--blue);
  text-decoration: none;
  background: var(--card2);
}

.portal-nav a:active,
.portal-nav a.active {
  color: var(--orange);
  border-bottom-color: var(--orange);
}

/* ── Overview Grid ── */

.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
}

.overview-card {
  text-align: center;
  padding: 1.2rem 1rem;
}

.overview-card .card-muted {
  margin-bottom: 0.6rem;
}

.overview-icon {
  width: 44px;
  height: 44px;
  background: #0069cd;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.6rem;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: 'Segoe UI', -apple-system, sans-serif;
}

/* ── Security Grid ── */

.security-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
}

.security-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.security-list li {
  padding: 0.3rem 0;
  color: var(--grayLight);
  font-size: 0.85rem;
  padding-left: 1.2rem;
  position: relative;
}

.security-list li::before {
  content: "\2713";
  color: var(--green);
  position: absolute;
  left: 0;
  font-weight: bold;
}

/* ── FAQ Table ── */

.faq-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-top: 0.5rem;
}

.faq-table th,
.faq-table td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.7rem;
  text-align: left;
}

.faq-table th {
  background: var(--card2);
  color: var(--white);
  font-weight: 600;
}

.faq-table td {
  color: var(--grayLight);
}

/* ── Config Reference Tables ── */

.config-filter {
  width: 100%;
  margin-bottom: 1.2rem;
}

.config-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-bottom: 1.5rem;
}

.config-table th,
.config-table td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.7rem;
  text-align: left;
  vertical-align: top;
}

.config-table th {
  background: var(--card2);
  color: var(--white);
  font-weight: 600;
  position: sticky;
  top: 2.4rem;
  z-index: 10;
}

.config-table td {
  color: var(--grayLight);
}

.config-table td:first-child {
  font-family: 'Cascadia Code', Consolas, monospace;
  font-size: 0.78rem;
  color: var(--orange);
  white-space: nowrap;
}

.config-table td:nth-child(2) {
  font-family: 'Cascadia Code', Consolas, monospace;
  font-size: 0.78rem;
  color: var(--green);
}

.config-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.table-subheader td {
  background: var(--card) !important;
  color: var(--blue) !important;
  font-weight: 600;
  font-family: 'Segoe UI', -apple-system, sans-serif !important;
  font-size: 0.82rem !important;
  white-space: normal !important;
  padding: 0.6rem 0.7rem;
  border-top: 2px solid var(--border);
}

/* ── Scroll to Top ── */

.scroll-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--card2);
  color: var(--grayLight);
  border: 1px solid var(--border);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.scroll-top:hover {
  background: var(--orange);
  color: #ffffff;
  border-color: var(--orange);
}

.scroll-top.visible {
  display: flex;
}

/* ── Utilities ── */

.u-hidden { display: none; }
.user-authenticated { color: var(--green); }

/* ── Noscript ── */

.noscript-msg {
  background: var(--card);
  border: 1px solid var(--orange);
  border-radius: var(--radius);
  padding: 1rem 1.4rem;
  margin-bottom: 1.5rem;
  color: var(--orangeLight);
  text-align: center;
}

/* ── Wizard ── */

.wizard-fields {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.5rem 0;
}

.wizard-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  color: var(--gray);
  font-size: 0.82rem;
}

.wizard-label-inline {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.wizard-hint {
  color: var(--grayDark);
  font-size: 0.75rem;
}

.wizard-input {
  background: #0C0E14;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.45rem 0.7rem;
  color: #c9d1d9;
  font-family: 'Cascadia Code', Consolas, monospace;
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.15s;
}

.wizard-input:focus {
  border-color: var(--blue);
}

.wizard-input::placeholder {
  color: var(--grayDark);
}

select.wizard-input {
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239DA3B0' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  padding-right: 2rem;
}

.wizard-actions {
  display: flex;
  gap: 0.8rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.wizard-btn {
  padding: 0.5rem 1.5rem;
  font-size: 0.85rem;
}

.wizard-preview-file {
  margin-top: 1rem;
}

.wizard-preview-file h4 {
  color: var(--blue);
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

.wizard-preview-file pre {
  background: #0C0E14;
  padding: 1rem;
  overflow-x: auto;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-family: 'Cascadia Mono', Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #c9d1d9;
  white-space: pre;
  max-height: 400px;
  overflow-y: auto;
}

/* ── Responsive ── */

@media (max-width: 640px) {
  header { padding: 1.5rem 1rem; }
  header h1 { font-size: 1.8rem; }
  .header-logo { gap: 0.5rem; }
  .header-logo svg { width: 36px; height: 36px; }
  .container { padding: 1.2rem 1rem; }
  .section-title { font-size: 1.1rem; }
  .card { padding: 1rem; }
  .installer-card { padding: 1.2rem 1rem; }
  .installer-btn { padding: 0.6rem 1.5rem; font-size: 0.9rem; }
  .file-list li { flex-wrap: wrap; gap: 0.3rem; }
  .file-list .name { min-width: 100%; }
  .install-cmd { font-size: 0.75rem; padding: 0.8rem; }
  .sys-req { flex-direction: column; }
  .footer-links { flex-direction: column; gap: 0.5rem; }
  .overview-grid { grid-template-columns: 1fr; }
  .security-grid { grid-template-columns: 1fr; }
  .portal-nav a { padding: 0.5rem 0.8rem; font-size: 0.75rem; }
}

/* ============================================================================
   Portal sidebar — 3-level navigation built by portal-sidebar.js
   L1 = <section id="*-section">; L2 = h3 inside; L3 = h4 inside (#586).
   Light theme matching the rest of the portal:
     bg:        white card on a slate-50 page background
     text:      slate-700 default, slate-500 muted
     accent:    KodeMed orange (#F05008) for the active section/link
     border:    slate-200, same as cards
   Anchored below the sticky header via top: var(--portal-header-height).
   ========================================================================== */

.portal-sidebar {
  position: fixed;
  top: var(--portal-header-height, 60px);
  left: 0;
  bottom: 0;
  width: 240px;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--card);                  /* #ffffff */
  border-right: 1px solid var(--border);    /* #e2e8f0 */
  padding: 0.5rem 0;
  z-index: 50;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.portal-sidebar::-webkit-scrollbar { width: 6px; }
.portal-sidebar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.portal-sidebar::-webkit-scrollbar-track { background: transparent; }

.portal-sidebar-nav { font-size: 0.85rem; }

.sb-l1, .sb-l2 {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sb-l1-item {
  border-left: 3px solid transparent;
  transition: border-color 0.15s, background 0.15s;
}

.sb-l1-item.active {
  border-left-color: var(--orange);
  background: rgba(240, 80, 8, 0.06);
}

.sb-l1-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.9rem;
  color: var(--white);                     /* #1e293b — slate-900 */
  text-decoration: none;
  font-weight: 500;
  user-select: none;
}

.sb-l1-link:hover {
  background: var(--card2);                /* #f1f5f9 — slate-100 */
  color: var(--blue);
}

.sb-l1-item.active .sb-l1-link { color: var(--orange); }

.sb-l1-arrow {
  /* SVG chevron rendered at 12×12 — uniform across platforms.
     Rotates 90deg when the L2 list opens. The padding around it is
     padding/margin trickery so the click-target is bigger than the
     glyph (Fitts's Law) but does not visually shift the text label. */
  display: inline-block;
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  color: var(--gray);
  transition: transform 0.15s ease, color 0.15s ease;
  cursor: pointer;
  padding: 4px;
  margin: -4px -2px -4px -4px;
  box-sizing: content-box;
  vertical-align: middle;
}

.sb-l1-arrow.open { transform: rotate(90deg); color: var(--orange); }

.sb-l1-label { flex: 1; }

.sb-l2 {
  background: var(--card2);                /* #f1f5f9 — same tone as cards */
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.sb-l2 li { margin: 0; }

.sb-l2-link {
  display: block;
  padding: 0.4rem 1rem 0.4rem 2.2rem;
  color: var(--gray);                      /* #556677 — muted slate */
  text-decoration: none;
  font-size: 0.8rem;
  border-left: 2px solid transparent;
  transition: color 0.1s, border-color 0.1s, background 0.1s;
}

.sb-l2-link:hover {
  color: var(--white);                     /* darken on hover */
  background: rgba(0, 105, 205, 0.05);     /* light blue tint */
}

.sb-l2-link.active {
  /* Demoted: L1 carries the visual weight (orange border + tinted bg + bold
     orange text). L2 active just darkens to brand orange + bumps weight,
     so the hierarchy L1 ≫ L2 stays clear when both are simultaneously
     "active" (which IntersectionObserver does almost always). */
  color: var(--orange);
  font-weight: 600;
}

/* ─── L3 (h4 anchors under each h3) ────────────────────────────────
   Visual hierarchy: L1 (section)  ≫  L2 (h3)  ≫  L3 (h4).
   L3 is the most demoted, used only inside sections that have enough
   depth to warrant it (integration-section, wizard-section, etc.). */
.sb-l3 {
  background: var(--card2);
  list-style: none;
  padding: 0;
  margin: 0;
}

.sb-l3 li { margin: 0; }

.sb-l3-link {
  display: block;
  padding: 0.3rem 1rem 0.3rem 3.2rem;       /* deeper indent than L2's 2.2rem */
  color: var(--gray);
  text-decoration: none;
  font-size: 0.75rem;                       /* one notch smaller than L2 */
  border-left: 2px solid transparent;
  transition: color 0.1s, border-color 0.1s, background 0.1s;
}

.sb-l3-link:hover {
  color: var(--white);
  background: rgba(0, 105, 205, 0.05);
}

.sb-l3-link.active {
  color: var(--orange);
  font-weight: 600;
}

/* Push main content right on desktop when sidebar is mounted. */
body.has-portal-sidebar .portal-main-with-sidebar {
  margin-left: 240px;
}

/* Hamburger toggle — desktop hides it; mobile reveals via CSS below. */
.sidebar-toggle {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 110;                             /* above sticky header */
  background: rgba(255, 255, 255, 0.95);
  color: var(--blue);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  cursor: pointer;
  display: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.sidebar-toggle:hover {
  background: var(--orange);
  color: #ffffff;
  border-color: var(--orange);
}

/* Mobile / narrow: collapse sidebar; reveal hamburger. */
@media (max-width: 900px) {
  .portal-sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease-out;
    width: 260px;
    box-shadow: 2px 0 12px rgba(0,0,0,0.12);
  }
  .portal-sidebar.open { transform: translateX(0); }
  body.has-portal-sidebar .portal-main-with-sidebar { margin-left: 0; }
  .sidebar-toggle { display: inline-flex; }
}

