:root {
  color-scheme: light dark;
  --brand-orange: #e8923a;
  --brand-orange-deep: #d47820;
  --brand-green: #3d9b4a;
  --brand-green-soft: #5bb567;
  --ink: #1a2332;
  --ink-soft: #2d3a4d;
  --muted: #5c6b7a;
  --muted-soft: #8a97a5;
  --surface: #ffffff;
  --surface-warm: #faf7f3;
  --bg: #f7f4ef;
  --bg-deep: #efeae2;
  --line: rgba(26, 35, 50, 0.08);
  --shadow-soft: 0 24px 64px rgba(26, 35, 50, 0.08);
  --sidebar-w: 280px;
  --font-display: "Outfit", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --radius: 12px;
  --content-max: 760px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 2rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: color-mix(in srgb, var(--brand-orange) 35%, white);
  color: var(--ink);
}

a {
  color: var(--brand-orange-deep);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.brand-accent {
  color: var(--brand-orange-deep);
}

code {
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
  font-size: 0.9em;
  background: var(--bg-deep);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--ink-soft);
}

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 2rem 1.25rem 3rem;
  z-index: 20;
}

/* Logo z rodziny znaków Shopvil (../marka/README.md): napis „packhub” Geist 600,
   małe litery, odstęp od znaku = 1/4 jego wysokości. */
.logo-text {
  font-family: "Geist", system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 1.35rem;
  line-height: 1.25;
  color: var(--ink);
  text-decoration: none;
  margin-bottom: 0.25rem;
}

.sidebar-brand:hover {
  text-decoration: none;
  color: var(--brand-orange-deep);
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.sidebar-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-soft);
  margin-bottom: 1.75rem;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.nav-list a {
  display: block;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.nav-list a:hover {
  background: var(--surface-warm);
  color: var(--ink);
  text-decoration: none;
}

.nav-list a.active {
  background: color-mix(in srgb, var(--brand-orange) 12%, white);
  color: var(--brand-orange-deep);
  font-weight: 600;
}

.nav-group {
  margin-top: 1.25rem;
  margin-bottom: 0.35rem;
  padding: 0 0.75rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted-soft);
  font-weight: 600;
}

.nav-list li[hidden] {
  display: none;
}

.sidebar-search {
  margin-bottom: 1.25rem;
}

.sidebar-search input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.9rem;
}

.sidebar-search input::placeholder {
  color: var(--muted-soft);
}

.sidebar-search input:focus {
  outline: 2px solid var(--brand-orange);
  outline-offset: 1px;
}

.search-empty {
  margin: 0 0 0.75rem;
  padding: 0 0.75rem;
  font-size: 0.85rem;
  color: var(--muted-soft);
}

.main {
  position: relative;
  min-width: 0;
}

.main::before {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 40% at 10% 0%, rgba(232, 146, 58, 0.1), transparent 55%),
    radial-gradient(ellipse 50% 30% at 95% 5%, rgba(61, 155, 74, 0.07), transparent 50%);
  z-index: 0;
}

.content {
  position: relative;
  z-index: 1;
  max-width: calc(var(--content-max) + 6rem);
  margin: 0 auto;
  padding: 3.5rem 3rem 6rem;
  /* Długie ścieżki w <code> (np. %LOCALAPPDATA%\…) łamią się zamiast poszerzać stronę na wąskich ekranach */
  overflow-wrap: break-word;
}

.docs-hero {
  margin-bottom: 4rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--line);
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 1rem;
}

.hero-logo {
  display: block;
  width: 72px;
  height: 72px;
  flex-shrink: 0;
}

.docs-hero h1 {
  font-size: 2.7rem;
  line-height: 1.15;
  margin: 0;
  color: var(--ink);
}

.docs-hero .lead {
  font-size: 1.2rem;
  color: var(--muted);
  max-width: 36em;
  margin: 0;
  line-height: 1.65;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  margin-top: 1.75rem;
  font-size: 0.875rem;
  color: var(--muted-soft);
}

.hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.hero-meta .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-green);
}

.doc-section {
  margin-bottom: 4.5rem;
  max-width: var(--content-max);
  scroll-margin-top: 2rem;
}

.doc-section h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0 0 1rem;
  color: var(--ink);
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.doc-section h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  margin: 2.25rem 0 0.75rem;
  color: var(--ink-soft);
}

.doc-section h4 {
  font-size: 1.05rem;
  font-weight: 650;
  margin: 1.75rem 0 0.5rem;
  color: var(--ink-soft);
}

.doc-section p {
  margin: 0 0 1rem;
  color: var(--ink-soft);
}

.doc-section ul,
.doc-section ol {
  margin: 0 0 1.25rem;
  padding-left: 1.35rem;
  color: var(--ink-soft);
}

.doc-section li {
  margin-bottom: 0.4rem;
}

.doc-section li::marker {
  color: var(--brand-orange);
}

.callout {
  background: var(--surface);
  border-left: 3px solid var(--brand-orange);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  box-shadow: var(--shadow-soft);
}

.callout.green {
  border-left-color: var(--brand-green);
}

.callout p {
  margin: 0;
  font-size: 0.95rem;
}

.callout strong {
  color: var(--ink);
}

.stack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}

.stack-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
}

.stack-item h4 {
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-soft);
  font-weight: 600;
}

.stack-item ul {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.92rem;
}

.flow-steps {
  list-style: none;
  margin: 1.5rem 0 2rem;
  padding: 0;
  counter-reset: step;
}

.flow-steps li {
  position: relative;
  padding: 0 0 1.5rem 3rem;
  counter-increment: step;
}

.flow-steps li:last-child {
  padding-bottom: 0;
}

.flow-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--brand-orange) 15%, white);
  color: var(--brand-orange-deep);
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flow-steps li::after {
  content: "";
  position: absolute;
  left: 0.95rem;
  top: 2.15rem;
  bottom: 0;
  width: 2px;
  background: var(--line);
}

.flow-steps li:last-child::after {
  display: none;
}

.flow-steps strong {
  display: block;
  color: var(--ink);
  margin-bottom: 0.2rem;
}

.flow-steps p {
  margin: 0;
  font-size: 0.95rem;
}

.arch-diagram {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin: 1.5rem 0 2rem;
  overflow-x: auto;
}

.arch-diagram pre {
  margin: 0;
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--ink-soft);
  white-space: pre;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.col-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
}

.col-block h3,
.col-block h4 {
  margin-top: 0;
  font-size: 1.1rem;
}

.col-block h3 .badge,
.col-block h4 .badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2em 0.55em;
  border-radius: 4px;
  margin-left: 0.4rem;
  vertical-align: middle;
}

.badge.win {
  background: color-mix(in srgb, var(--brand-orange) 18%, white);
  color: var(--brand-orange-deep);
}

.badge.and {
  background: color-mix(in srgb, var(--brand-green) 18%, white);
  color: var(--brand-green);
}

.task-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.25rem 0 2rem;
}

.task-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem 1.25rem;
  box-shadow: var(--shadow-soft);
}

.task-card-head {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.task-card-head h5 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.task-badge {
  align-self: flex-start;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2em 0.55em;
  border-radius: 4px;
  background: color-mix(in srgb, var(--brand-orange) 18%, white);
  color: var(--brand-orange-deep);
}

.task-badge.invoice {
  background: color-mix(in srgb, var(--brand-green) 18%, white);
  color: var(--brand-green);
}

.doc-section .task-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: task-step;
}

.doc-section .task-steps > li {
  position: relative;
  padding-left: 2.15rem;
  margin-bottom: 1rem;
  counter-increment: task-step;
}

.doc-section .task-steps > li:last-child {
  margin-bottom: 0;
}

.doc-section .task-steps > li::before {
  content: counter(task-step);
  position: absolute;
  left: 0;
  top: 0.1rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--brand-orange) 15%, white);
  color: var(--brand-orange-deep);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.doc-section .task-steps > li::marker {
  content: none;
}

.task-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-soft);
  margin-bottom: 0.2rem;
}

.task-value {
  display: block;
  font-size: 0.92rem;
  color: var(--ink-soft);
  line-height: 1.45;
}

.task-note {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.doc-section .task-conds {
  margin: 0.15rem 0 0;
  padding-left: 1.05rem;
  font-size: 0.9rem;
}

.doc-section .task-conds li {
  margin-bottom: 0.3rem;
}

.doc-section .task-conds li:last-child {
  margin-bottom: 0;
}

.task-diff {
  display: inline-block;
  padding: 0.05em 0.45em;
  border-radius: 4px;
  background: color-mix(in srgb, var(--brand-orange) 16%, white);
  color: var(--brand-orange-deep);
  font-weight: 700;
}

.device-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 1.5rem;
  padding: 0;
  list-style: none;
}

.device-list li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 0;
}

.table-wrap {
  overflow-x: auto;
  margin: 1.25rem 0 1.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  background: var(--surface-warm);
  font-weight: 600;
  color: var(--ink);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tr:last-child td {
  border-bottom: none;
}

td {
  color: var(--ink-soft);
}

.faq-item {
  border-bottom: 1px solid var(--line);
  padding: 1.25rem 0;
}

.faq-item:first-of-type {
  padding-top: 0.5rem;
}

.faq-item h4 {
  margin: 0 0 0.5rem;
  color: var(--ink);
}

.faq-item p {
  margin: 0;
}

.support-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  margin-top: 1.5rem;
  box-shadow: var(--shadow-soft);
}

.support-box h3 {
  margin-top: 0;
}

.mobile-toggle {
  display: none;
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 40;
  width: 3rem;
  height: 3rem;
  border: none;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}

.sidebar-overlay {
  display: none;
}

footer.doc-footer {
  max-width: var(--content-max);
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
  color: var(--muted-soft);
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: none;
    width: min(var(--sidebar-w), 85vw);
  }

  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: var(--shadow-soft);
  }

  .sidebar-overlay.is-visible {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(26, 35, 50, 0.35);
    z-index: 15;
  }

  .mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .content {
    padding: 2rem 1.25rem 5rem;
  }

  .two-col,
  .task-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --brand-orange: #f0a24e;
    --brand-orange-deep: #f7b567;
    --brand-green: #5bc26a;
    --brand-green-soft: #7fd08c;
    --ink: #e7ebf2;
    --ink-soft: #c3cbd8;
    --muted: #93a1b0;
    --muted-soft: #6b7887;
    --surface: #1b232f;
    --surface-warm: #212a38;
    --bg: #12171f;
    --bg-deep: #0c1015;
    --line: rgba(255, 255, 255, 0.1);
    --shadow-soft: 0 24px 64px rgba(0, 0, 0, 0.45);
  }

  ::selection {
    background: color-mix(in srgb, var(--brand-orange) 35%, black);
    color: var(--ink);
  }

  .mobile-toggle {
    background: var(--surface);
    color: var(--ink);
  }
}

/* Dokumentacja techniczna bywa drukowana/eksportowana do PDF przez magazyniera bez
   dostępu do komputera przy stanowisku pakowania — wymuszamy jasny, oszczędny w tuszu
   wydruk niezależnie od motywu ekranu i chowamy elementy nawigacyjne bez sensu na papierze. */
@media print {
  :root {
    --bg: #ffffff;
    --bg-deep: #f2f2f2;
    --surface: #ffffff;
    --surface-warm: #f5f5f5;
    --ink: #000000;
    --ink-soft: #1a1a1a;
    --muted: #444444;
    --muted-soft: #666666;
    --line: #cccccc;
    --shadow-soft: none;
  }

  .sidebar,
  .sidebar-overlay,
  .mobile-toggle {
    display: none !important;
  }

  .layout {
    display: block;
  }

  .main::before {
    display: none;
  }

  .content {
    max-width: 100%;
    padding: 0;
    margin: 0;
  }

  a {
    color: inherit;
    text-decoration: underline;
  }

  .callout,
  .stack-item,
  .col-block,
  .task-card,
  .support-box {
    box-shadow: none;
    border: 1px solid var(--line);
  }

  .doc-section h2,
  .doc-section h3,
  .doc-section h4 {
    break-after: avoid;
  }

  .callout,
  .table-wrap,
  .task-card,
  .col-block,
  .stack-item,
  .flow-steps li,
  .faq-item {
    break-inside: avoid;
  }
}
