/* ==========================================================================
   TRBK — Baza Wiedzy
   Design system: monochrom / grafit, premium, minimalistyczny
   Motyw jasny + ciemny. Brak zależności sieciowych (działa offline).
   ========================================================================== */

/* ----- Tokens ----------------------------------------------------------- */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --sidebar-w: 290px;
  --toc-w: 232px;
  --content-max: 768px;
  --radius: 10px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  --ease: cubic-bezier(.4, 0, .2, 1);
  --shadow-sm: 0 1px 2px rgba(16,16,18,.06), 0 1px 3px rgba(16,16,18,.04);
  --shadow-md: 0 4px 14px rgba(16,16,18,.08), 0 2px 6px rgba(16,16,18,.05);
  --shadow-lg: 0 18px 50px rgba(16,16,18,.18), 0 6px 18px rgba(16,16,18,.10);
}

/* Light (default) */
:root,
[data-theme="light"] {
  --bg: #ffffff;
  --bg-elev: #ffffff;
  --sidebar-bg: #fafafa;
  --surface: #f6f6f7;
  --surface-2: #f0f0f1;
  --hover: #f2f2f3;

  --border: #e8e8ea;
  --border-strong: #d9d9dc;

  --text: #1a1a1d;
  --text-2: #5c5c63;
  --text-3: #8a8a92;

  --accent: #18181b;          /* grafit / ink */
  --accent-soft: #2a2a2e;
  --on-accent: #ffffff;
  --accent-ring: rgba(24,24,27,.18);
  --accent-tint: #f1f1f2;

  --code-bg: #f4f4f5;
  --kbd-bg: #ffffff;

  /* Semantyczne callouty — zdesaturowane, premium */
  --info-bg: #f4f5f7;   --info-bd: #d8dbe0; --info-fg: #3f4654; --info-ic: #6b7280;
  --tip-bg: #f0f6f2;    --tip-bd: #cfe6d6;  --tip-fg: #2f5d40;  --tip-ic: #2f8f5b;
  --warn-bg: #fbf6ec;   --warn-bd: #f0e0c0; --warn-fg: #7a5a16; --warn-ic: #c4901f;
  --danger-bg: #fcf2f1; --danger-bd: #f3d6d3;--danger-fg: #8c3a33;--danger-ic: #cf4a3e;
  --success-bg:#eef7f0; --success-bd:#c9e6d2;--success-fg:#266140;--success-ic:#2f9e63;
}

/* Dark (graphite) */
[data-theme="dark"] {
  --bg: #0f0f10;
  --bg-elev: #161618;
  --sidebar-bg: #131315;
  --surface: #1a1a1d;
  --surface-2: #202024;
  --hover: #1e1e22;

  --border: #262629;
  --border-strong: #34343a;

  --text: #ededee;
  --text-2: #a4a4ad;
  --text-3: #74747d;

  --accent: #fafafa;          /* w ciemnym akcent = jasny */
  --accent-soft: #e4e4e7;
  --on-accent: #18181b;
  --accent-ring: rgba(250,250,250,.22);
  --accent-tint: #202024;

  --code-bg: #1c1c20;
  --kbd-bg: #202024;

  --info-bg: #181b20;   --info-bd: #2c313b; --info-fg: #c2c7d0; --info-ic: #9aa3b2;
  --tip-bg: #14201a;    --tip-bd: #244a34;  --tip-fg: #a7d8b8;  --tip-ic: #56bd81;
  --warn-bg: #221c10;   --warn-bd: #4a3c1c; --warn-fg: #e2c184; --warn-ic: #d6a740;
  --danger-bg: #231513; --danger-bd: #4d2a26;--danger-fg: #f0b3ac;--danger-ic: #e0685b;
  --success-bg:#13201a; --success-bd:#244a35;--success-fg:#9fdcb4;--success-ic:#46b377;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 6px 20px rgba(0,0,0,.5);
  --shadow-lg: 0 22px 60px rgba(0,0,0,.6);
}

/* ----- Reset ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 15.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -.01em; font-weight: 650; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--accent); color: var(--on-accent); }

/* Focus visibility */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Skip link */
.skip-link {
  position: fixed; left: 12px; top: -60px; z-index: 200;
  background: var(--accent); color: var(--on-accent);
  padding: 10px 16px; border-radius: var(--radius-sm);
  transition: top .18s var(--ease); font-weight: 600; font-size: 14px;
}
.skip-link:focus { top: 12px; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

/* ==========================================================================
   Layout
   ========================================================================== */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

/* ----- Sidebar ---------------------------------------------------------- */
.sidebar {
  grid-column: 1;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  z-index: 60;
}
.sidebar__brand {
  display: flex; align-items: center; gap: 11px;
  padding: 18px 18px 14px;
  flex-shrink: 0;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center;
  font-weight: 750; font-size: 15px; letter-spacing: .02em;
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-size: 15px; letter-spacing: -.01em; }
.brand-text span { font-size: 11.5px; color: var(--text-3); font-weight: 500; letter-spacing: .02em; text-transform: uppercase; }

.sidebar__search {
  margin: 2px 14px 10px;
  display: flex; align-items: center; gap: 9px;
  padding: 9px 11px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-3); font-size: 13.5px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
  width: calc(100% - 28px);
  text-align: left;
}
.sidebar__search:hover { border-color: var(--border-strong); }
.sidebar__search .kbd { margin-left: auto; }
.sidebar__search svg { flex-shrink: 0; }

.sidebar__nav {
  overflow-y: auto;
  padding: 4px 10px 28px;
  flex: 1;
  overscroll-behavior: contain;
}

/* Role block */
.nav-role { margin-bottom: 6px; }
.nav-role__head {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border: none; background: transparent;
  color: var(--text); font-weight: 600; font-size: 13.5px;
  border-radius: var(--radius-sm);
  text-align: left;
}
.nav-role__head:hover { background: var(--hover); }
.nav-role__head .role-ic {
  width: 24px; height: 24px; border-radius: 7px;
  background: var(--surface-2); color: var(--text-2);
  display: grid; place-items: center; flex-shrink: 0;
}
.nav-role__head .chev { margin-left: auto; color: var(--text-3); transition: transform .2s var(--ease); }
.nav-role[data-open="false"] .chev { transform: rotate(-90deg); }
.nav-role__head[disabled] { color: var(--text-3); cursor: default; }
.nav-role__head[disabled]:hover { background: transparent; }
.nav-role__badge {
  margin-left: auto; font-size: 10.5px; font-weight: 600;
  color: var(--text-3); background: var(--surface-2);
  padding: 2px 7px; border-radius: 99px; letter-spacing: .02em;
}

.nav-role__body { overflow: hidden; }
.nav-role[data-open="false"] .nav-role__body { display: none; }

.nav-group { margin: 2px 0 8px; }
.nav-group__label {
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-3);
  padding: 10px 10px 5px 12px;
}
.nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px 7px 12px;
  margin: 1px 0;
  border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 13.5px;
  border-left: 2px solid transparent;
  position: relative;
}
.nav-link:hover { background: var(--hover); color: var(--text); }
.nav-link .dot { width: 5px; height: 5px; border-radius: 99px; background: var(--text-3); flex-shrink: 0; opacity: .55; }
.nav-link[aria-current="page"] {
  background: var(--accent-tint);
  color: var(--text);
  font-weight: 600;
  border-left-color: var(--accent);
}
.nav-link[aria-current="page"] .dot { background: var(--accent); opacity: 1; }

.sidebar__foot {
  flex-shrink: 0; padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--text-3);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}

/* ----- Main ------------------------------------------------------------- */
.main { grid-column: 2; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  padding: 11px 22px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar__crumbs { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-3); min-width: 0; }
.topbar__crumbs a:hover { color: var(--text); }
.topbar__crumbs .sep { opacity: .6; }
.topbar__crumbs .cur { color: var(--text-2); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__spacer { flex: 1; }

.icon-btn {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-elev);
  color: var(--text-2); display: grid; place-items: center;
  transition: background .14s var(--ease), color .14s var(--ease), border-color .14s var(--ease);
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--hover); color: var(--text); border-color: var(--border-strong); }

.topbar__search {
  display: none; align-items: center; gap: 9px;
  padding: 8px 12px; min-width: 220px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-elev); color: var(--text-3); font-size: 13px;
}
.topbar__search:hover { border-color: var(--border-strong); }
.topbar__search .kbd { margin-left: auto; }

.hamburger { display: none; }

/* ----- Article ---------------------------------------------------------- */
.content-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--toc-w);
  gap: 48px;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 40px 96px;
}
.content-wrap.no-toc { grid-template-columns: minmax(0, 1fr); max-width: calc(var(--content-max) + 80px); }

.article { max-width: var(--content-max); min-width: 0; }
.article__eyebrow { font-size: 12.5px; font-weight: 650; color: var(--text-3); letter-spacing: .04em; text-transform: uppercase; margin-bottom: 12px; }
.article__title { font-size: clamp(28px, 4vw, 38px); margin: 0 0 14px; font-weight: 720; }
.article__lead { font-size: 18px; color: var(--text-2); line-height: 1.6; margin: 0 0 22px; }
.article__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  padding: 13px 0 0; margin-bottom: 30px;
  border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-3);
}
.article__meta .m { display: inline-flex; align-items: center; gap: 6px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 11.5px; font-weight: 550; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border);
  padding: 3px 9px; border-radius: 99px;
}
.meta-print { margin-left: auto; }
.meta-print button {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); background: var(--bg-elev);
  color: var(--text-2); padding: 5px 11px; border-radius: 99px; font-size: 12.5px;
}
.meta-print button:hover { background: var(--hover); color: var(--text); }

/* Block typography */
.article :where(h2) { font-size: 22px; margin: 38px 0 14px; padding-top: 6px; scroll-margin-top: 84px; }
.article :where(h3) { font-size: 17px; margin: 26px 0 10px; scroll-margin-top: 84px; color: var(--text); }
.article p { margin: 0 0 15px; }
.article a.inline { color: var(--text); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; text-decoration-thickness: 1.5px; transition: text-decoration-color .15s; }
.article a.inline:hover { text-decoration-color: var(--accent); }
.article strong { font-weight: 650; }
.article ul, .article ol { margin: 0 0 16px; padding-left: 22px; }
.article li { margin: 5px 0; }
.article li::marker { color: var(--text-3); }
.heading-anchor { color: var(--text-3); opacity: 0; margin-left: 8px; font-weight: 400; transition: opacity .14s; text-decoration: none; }
.article h2:hover .heading-anchor, .article h3:hover .heading-anchor { opacity: 1; }

code:not(pre code) {
  font-family: var(--font-mono); font-size: .87em;
  background: var(--code-bg); padding: .12em .42em; border-radius: 5px;
  border: 1px solid var(--border);
}

/* Lead block */
.block-lead { font-size: 17.5px; color: var(--text-2); line-height: 1.62; margin: 0 0 22px; }

/* Key-value */
.kv { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin: 0 0 22px; }
.kv__row { display: grid; grid-template-columns: 190px 1fr; gap: 0; border-top: 1px solid var(--border); }
.kv__row:first-child { border-top: none; }
.kv__k { padding: 11px 16px; background: var(--surface); font-size: 13px; font-weight: 600; color: var(--text-2); }
.kv__v { padding: 11px 16px; font-size: 14px; }

/* Checklist */
.checklist { margin: 0 0 22px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.checklist__title { padding: 12px 16px; font-weight: 600; font-size: 13.5px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.checklist__progress { font-size: 12px; color: var(--text-3); font-weight: 600; }
.check-item { display: flex; align-items: flex-start; gap: 11px; padding: 10px 16px; border-top: 1px solid var(--border); cursor: pointer; transition: background .12s; }
.check-item:first-child { border-top: none; }
.check-item:hover { background: var(--hover); }
.check-item input { position: absolute; opacity: 0; width: 0; height: 0; }
.check-box {
  width: 19px; height: 19px; border-radius: 6px; flex-shrink: 0; margin-top: 1px;
  border: 1.5px solid var(--border-strong); background: var(--bg-elev);
  display: grid; place-items: center; transition: all .14s var(--ease); color: transparent;
}
.check-item input:checked + .check-box { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.check-item input:focus-visible + .check-box { outline: 2px solid var(--accent); outline-offset: 2px; }
.check-item__text { font-size: 14px; transition: color .14s, text-decoration-color .14s; }
.check-item input:checked ~ .check-item__text { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--text-3); }

/* Steps */
.steps { margin: 0 0 24px; position: relative; }
.step { display: grid; grid-template-columns: 34px 1fr; gap: 16px; padding-bottom: 22px; position: relative; }
.step:last-child { padding-bottom: 0; }
.step::before { content: ""; position: absolute; left: 16px; top: 34px; bottom: 0; width: 2px; background: var(--border); }
.step:last-child::before { display: none; }
.step__num {
  width: 34px; height: 34px; border-radius: 50%; z-index: 1;
  background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center; font-weight: 650; font-size: 14px;
}
.step__body { padding-top: 4px; }
.step__title { font-weight: 650; font-size: 15.5px; margin: 0 0 4px; }
.step__body p:last-child { margin-bottom: 0; }

/* Callout / note */
.note {
  display: grid; grid-template-columns: 22px 1fr; gap: 13px;
  padding: 14px 16px; margin: 0 0 22px;
  border: 1px solid var(--info-bd); background: var(--info-bg);
  border-radius: var(--radius); color: var(--info-fg);
}
.note__ic { color: var(--info-ic); margin-top: 1px; }
.note__title { font-weight: 650; font-size: 14px; margin-bottom: 3px; color: inherit; }
.note__body { font-size: 14px; line-height: 1.58; }
.note__body :last-child { margin-bottom: 0; }
.note__body a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.note--tip { border-color: var(--tip-bd); background: var(--tip-bg); color: var(--tip-fg); } .note--tip .note__ic { color: var(--tip-ic); }
.note--warn { border-color: var(--warn-bd); background: var(--warn-bg); color: var(--warn-fg); } .note--warn .note__ic { color: var(--warn-ic); }
.note--danger { border-color: var(--danger-bd); background: var(--danger-bg); color: var(--danger-fg); } .note--danger .note__ic { color: var(--danger-ic); }
.note--success { border-color: var(--success-bd); background: var(--success-bg); color: var(--success-fg); } .note--success .note__ic { color: var(--success-ic); }

/* Table */
.table-wrap { margin: 0 0 24px; border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
table.tbl { border-collapse: collapse; width: 100%; font-size: 13.8px; }
table.tbl caption { text-align: left; font-size: 12.5px; color: var(--text-3); padding: 10px 14px 0; caption-side: bottom; }
table.tbl th, table.tbl td { padding: 11px 15px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
table.tbl thead th { background: var(--surface); font-weight: 650; font-size: 12.5px; letter-spacing: .02em; color: var(--text-2); white-space: nowrap; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover { background: var(--hover); }

/* Accordion */
.accordion { margin: 0 0 22px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.acc-item { border-top: 1px solid var(--border); }
.acc-item:first-child { border-top: none; }
.acc-head {
  width: 100%; text-align: left; border: none; background: var(--bg-elev);
  padding: 14px 16px; display: flex; align-items: center; gap: 12px;
  font-weight: 600; font-size: 14.5px; color: var(--text);
}
.acc-head:hover { background: var(--hover); }
.acc-head .acc-ic { margin-left: auto; color: var(--text-3); transition: transform .2s var(--ease); flex-shrink: 0; }
.acc-item[data-open="true"] .acc-ic { transform: rotate(180deg); }
.acc-panel { padding: 0 16px; max-height: 0; overflow: hidden; transition: max-height .26s var(--ease), padding .26s var(--ease); }
.acc-item[data-open="true"] .acc-panel { padding: 2px 16px 16px; max-height: 1400px; }
.acc-panel p:last-child { margin-bottom: 0; }

/* Tabs */
.tabs { margin: 0 0 24px; }
.tabs__list { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs__list::-webkit-scrollbar { display: none; }
.tab-btn {
  border: none; background: transparent; padding: 10px 14px;
  font-size: 13.5px; font-weight: 550; color: var(--text-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab-btn:hover { color: var(--text); }
.tab-btn[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 650; }
.tab-panel { padding-top: 20px; }
.tab-panel[hidden] { display: none; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin: 0 0 24px; }
.card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; background: var(--bg-elev);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.card__top { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.card__ic { width: 32px; height: 32px; border-radius: 8px; background: var(--surface-2); color: var(--text-2); display: grid; place-items: center; flex-shrink: 0; }
.card__title { font-weight: 650; font-size: 14.5px; }
.card__tag { margin-left: auto; font-size: 10.5px; font-weight: 600; color: var(--text-3); background: var(--surface); padding: 2px 8px; border-radius: 99px; border: 1px solid var(--border); }
.card__body { font-size: 13.3px; color: var(--text-2); line-height: 1.55; }
.card__body a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }

/* Media placeholders / image / video */
.media { margin: 0 0 24px; }
.media__frame {
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface);
}
.media__frame img { width: 100%; height: auto; display: block; }
.media__ph {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text-3);
  display: grid; place-items: center; text-align: center;
  padding: 38px 20px; gap: 8px; min-height: 150px;
}
.media__ph .ph-ic { color: var(--text-3); }
.media__ph strong { color: var(--text-2); font-size: 14px; font-weight: 600; }
.media__ph span { font-size: 12.5px; max-width: 380px; }
.media__cap { font-size: 12.5px; color: var(--text-3); margin-top: 8px; text-align: center; }
.video-embed { position: relative; padding-bottom: 56.25%; height: 0; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Files */
.files { display: flex; flex-direction: column; gap: 8px; margin: 0 0 24px; }
.file-item {
  display: flex; align-items: center; gap: 13px;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-elev); transition: border-color .15s, background .15s;
}
.file-item:hover { border-color: var(--border-strong); background: var(--hover); }
.file-item__ic { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex-shrink: 0; font-size: 10px; font-weight: 700; letter-spacing: .03em; }
.file-item__meta { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.file-item__name { font-weight: 600; font-size: 14px; line-height: 1.35; }
.file-item__note { display: block; font-size: 12.5px; color: var(--text-3); line-height: 1.4; }
.file-item__dl { color: var(--text-3); flex-shrink: 0; }
.file-item:hover .file-item__dl { color: var(--text); }

/* Links list */
.linklist { display: flex; flex-direction: column; gap: 6px; margin: 0 0 24px; }
.linklist a {
  display: flex; align-items: center; gap: 10px; padding: 10px 13px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-elev);
  font-size: 14px; transition: border-color .15s, background .15s;
}
.linklist a:hover { border-color: var(--border-strong); background: var(--hover); }
.linklist a .ll-note { color: var(--text-3); font-size: 12.5px; margin-left: auto; }
.linklist a .ll-ext { color: var(--text-3); }

/* Quote */
.quote { margin: 0 0 24px; padding: 4px 0 4px 20px; border-left: 3px solid var(--border-strong); color: var(--text-2); font-style: italic; }
.quote cite { display: block; margin-top: 8px; font-size: 12.5px; color: var(--text-3); font-style: normal; }

/* Divider */
.divider { border: none; border-top: 1px solid var(--border); margin: 32px 0; }

/* Prev / next */
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--border); }
.prevnext a {
  display: flex; flex-direction: column; gap: 4px; padding: 15px 18px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev);
  transition: border-color .15s, background .15s;
}
.prevnext a:hover { border-color: var(--border-strong); background: var(--hover); }
.prevnext .pn-dir { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.prevnext .pn-title { font-weight: 600; font-size: 14.5px; }
.prevnext a.next { text-align: right; } .prevnext a.next .pn-dir { justify-content: flex-end; }
.prevnext .empty { visibility: hidden; }

/* ----- Table of contents ------------------------------------------------ */
.toc { position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 110px); overflow-y: auto; }
.toc__label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 12px; padding-left: 13px; }
.toc__list { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc__list a {
  display: block; padding: 5px 0 5px 13px; margin-left: -1px;
  border-left: 2px solid transparent;
  font-size: 13px; color: var(--text-3); line-height: 1.4;
  transition: color .14s, border-color .14s;
}
.toc__list a:hover { color: var(--text); }
.toc__list a.active { color: var(--text); border-left-color: var(--accent); font-weight: 600; }
.toc__list a.lvl-3 { padding-left: 25px; font-size: 12.5px; }

/* ==========================================================================
   Home / dashboard
   ========================================================================== */
.home { max-width: 1080px; margin: 0 auto; padding: 56px 40px 96px; }
.home__hero { margin-bottom: 44px; }
.home__kicker { font-size: 12.5px; font-weight: 650; color: var(--text-3); letter-spacing: .05em; text-transform: uppercase; margin-bottom: 14px; }
.home__title { font-size: clamp(30px, 5vw, 46px); font-weight: 740; margin: 0 0 16px; letter-spacing: -.02em; }
.home__sub { font-size: 18.5px; color: var(--text-2); max-width: 620px; line-height: 1.6; margin: 0 0 26px; }
.home__cta { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 11px 18px; border-radius: var(--radius-sm); font-size: 14.5px; font-weight: 600;
  border: 1px solid transparent; transition: all .15s var(--ease);
}
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-soft); }
.btn--ghost { background: var(--bg-elev); color: var(--text); border-color: var(--border); }
.btn--ghost:hover { background: var(--hover); border-color: var(--border-strong); }

.home__section-label { font-size: 12.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); margin: 0 0 16px; }
.role-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 48px; }
.role-card {
  display: block; border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 22px; background: var(--bg-elev);
  transition: border-color .16s, box-shadow .16s, transform .16s;
}
.role-card:not(.is-soon):hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.role-card.is-soon { opacity: .6; }
.role-card__top { display: flex; align-items: center; gap: 13px; margin-bottom: 14px; }
.role-card__ic { width: 44px; height: 44px; border-radius: 11px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; }
.role-card.is-soon .role-card__ic { background: var(--surface-2); color: var(--text-3); }
.role-card__name { font-weight: 680; font-size: 17px; }
.role-card__soon { font-size: 11px; font-weight: 600; color: var(--text-3); background: var(--surface); border: 1px solid var(--border); padding: 2px 9px; border-radius: 99px; margin-left: auto; }
.role-card__desc { font-size: 13.8px; color: var(--text-2); line-height: 1.55; margin-bottom: 14px; }
.role-card__foot { font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 7px; }
.role-card__count { display: inline-flex; align-items: center; gap: 6px; }

.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.quick-link {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev);
  transition: border-color .15s, background .15s;
}
.quick-link:hover { border-color: var(--border-strong); background: var(--hover); }
.quick-link__ic { color: var(--text-3); flex-shrink: 0; }
.quick-link__t { font-weight: 600; font-size: 14px; }
.quick-link__s { font-size: 12px; color: var(--text-3); }

/* ==========================================================================
   Search modal
   ========================================================================== */
.kbd {
  font-family: var(--font-sans); font-size: 11px; font-weight: 600;
  color: var(--text-3); background: var(--kbd-bg);
  border: 1px solid var(--border); border-bottom-width: 2px;
  padding: 1px 6px; border-radius: 5px; line-height: 1.5;
}
.search-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(16,16,18,.45);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 20px 20px;
  opacity: 0; visibility: hidden; transition: opacity .16s var(--ease), visibility .16s;
}
[data-theme="dark"] .search-overlay { background: rgba(0,0,0,.6); }
.search-overlay.open { opacity: 1; visibility: visible; }
.search-modal {
  width: 100%; max-width: 620px; background: var(--bg-elev);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); overflow: hidden;
  transform: translateY(-8px) scale(.99); transition: transform .18s var(--ease);
  display: flex; flex-direction: column; max-height: 70vh;
}
.search-overlay.open .search-modal { transform: none; }
.search-input-wrap { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.search-input-wrap svg { color: var(--text-3); flex-shrink: 0; }
.search-input { flex: 1; border: none; background: transparent; color: var(--text); font-size: 16px; outline: none; font-family: inherit; }
.search-input::placeholder { color: var(--text-3); }
.search-esc { flex-shrink: 0; }
.search-results { overflow-y: auto; padding: 8px; }
.search-empty { padding: 40px 20px; text-align: center; color: var(--text-3); font-size: 14px; }
.search-group__label { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); padding: 12px 12px 6px; }
.search-hit {
  display: block; padding: 11px 12px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid transparent;
}
.search-hit:hover, .search-hit.active { background: var(--hover); }
.search-hit.active { border-color: var(--border); }
.search-hit__top { display: flex; align-items: center; gap: 8px; }
.search-hit__title { font-weight: 600; font-size: 14px; color: var(--text); }
.search-hit__badge { font-size: 10.5px; font-weight: 600; color: var(--text-3); background: var(--surface); border: 1px solid var(--border); padding: 1px 7px; border-radius: 99px; margin-left: auto; flex-shrink: 0; }
.search-hit__snippet { font-size: 12.5px; color: var(--text-3); margin-top: 3px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.search-hit mark { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--text); padding: 0 1px; border-radius: 3px; font-weight: 600; }
.search-foot { display: flex; align-items: center; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-3); }
.search-foot .sf { display: inline-flex; align-items: center; gap: 5px; }

/* ==========================================================================
   Mobile / responsive
   ========================================================================== */
.scrim {
  position: fixed; inset: 0; z-index: 55; background: rgba(16,16,18,.4);
  opacity: 0; visibility: hidden; transition: opacity .2s var(--ease), visibility .2s;
}
.scrim.show { opacity: 1; visibility: visible; }

@media (min-width: 1280px) {
  .topbar__search { display: flex; }
}

@media (max-width: 1100px) {
  .content-wrap { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
}

@media (max-width: 920px) {
  :root { --sidebar-w: 280px; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: var(--sidebar-w); height: 100vh;
    transform: translateX(-102%); transition: transform .26s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .main { grid-column: 1; }
  .hamburger { display: grid; }
  .content-wrap { padding: 28px 22px 80px; }
  .home { padding: 40px 22px 80px; }
}

@media (max-width: 560px) {
  body { font-size: 15px; }
  .topbar { padding: 9px 14px; }
  .topbar__crumbs { font-size: 12px; }
  .content-wrap { padding: 22px 16px 64px; }
  .home { padding: 30px 16px 64px; }
  .article__title { font-size: 26px; }
  .article__lead { font-size: 16.5px; }
  .kv__row { grid-template-columns: 1fr; }
  .kv__k { border-bottom: 1px solid var(--border); }
  .prevnext { grid-template-columns: 1fr; }
  .step { grid-template-columns: 30px 1fr; gap: 13px; }
  .search-overlay { padding: 8vh 12px 12px; }
  .role-cards { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Print
   ========================================================================== */
@media print {
  .sidebar, .topbar, .toc, .prevnext, .scrim, .search-overlay, .meta-print { display: none !important; }
  .layout { grid-template-columns: 1fr; }
  .content-wrap { grid-template-columns: 1fr; max-width: 100%; padding: 0; }
  .main { grid-column: 1; }
  body { font-size: 11pt; }
  .acc-panel { max-height: none !important; padding: 2px 0 14px !important; }
  .acc-item { page-break-inside: avoid; }
  .tab-panel[hidden] { display: block !important; }
  .note, .card, .step, table.tbl { page-break-inside: avoid; }
  a.inline { text-decoration: underline; }
}

/* Loading state */
#app[aria-busy="true"]::after {
  content: ""; position: fixed; inset: 0; background: var(--bg);
  display: grid; place-items: center;
}
