.topbar {
  position: relative;
  min-height: 156px;
  height: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 22px;
  color: #fff;
  background: #101820;
  border-bottom: 3px solid #d4a72c;
}

.header-button-grid {
  width: auto;
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(210px, 290px));
  justify-content: start;
  gap: 14px;
}

.header-brand-button {
  min-width: 0;
  height: 121px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 28px;
  place-items: center;
  overflow: hidden;
  padding: 9px 14px 8px;
  color: #fff;
  background: #1a2831;
  border: 1px solid #52616a;
  border-radius: 9px;
  text-decoration: none;
  box-shadow: 0 5px 18px rgba(0, 0, 0, .18);
}

a.header-brand-button {
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

a.header-brand-button:hover,
a.header-brand-button:focus-visible {
  background: #243741;
  border-color: #d4a72c;
  outline: none;
  transform: translateY(-1px);
}

.header-juris-button {
  grid-template-rows: 1fr;
  cursor: pointer;
  border-left: 4px solid #d4a72c;
}

.header-guide-button {
  background: #000;
  border-left: 4px solid #f0c85a;
}
.header-guide-button:hover,
.header-guide-button:focus-visible { background: #111; }
.header-solia-button { border-left: 4px solid #087f75; }

.header-thumb {
  width: 100%;
  height: 76px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #fff;
  border-radius: 6px;
}

.header-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.header-thumb-juris { width: 88px; height: 88px; }
.header-thumb-guide { background: #000; }
.header-thumb-guide img { width: 57px; object-fit: cover; }
.header-thumb-solia { padding: 12px 20px; }

.header-button-copy {
  min-width: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #fff;
  line-height: 1.1;
  text-align: center;
}

.header-button-copy strong {
  color: #f4d978;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .07em;
}

.header-button-copy > span {
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.mobile-header-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-header-actions .mobile-topics-button,
.mobile-header-actions .mobile-print-button,
.mobile-header-actions .mobile-install-toggle,
.mobile-header-actions .mobile-version-toggle {
  min-width: 88px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  color: #fff;
  gap: 6px;
  background: #22333d;
  border: 1px solid #71808a;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.mobile-header-actions .mobile-install-toggle,
.mobile-header-actions .mobile-version-toggle { white-space: nowrap; }
.mobile-header-actions .mobile-install-toggle { min-width: 148px; }
.mobile-header-actions .mobile-version-toggle { min-width: 164px; }

.mobile-header-actions button { cursor: pointer; }

.mobile-header-actions button:hover,
.mobile-header-actions button:focus-visible {
  color: #fff;
  background: #314854;
  border-color: #d7b33d;
}

.mobile-header-actions button[aria-expanded="true"] {
  color: #172127;
  background: #f4d978;
  border-color: #f4d978;
}

.mobile-header-actions .mobile-install-toggle[data-install-state="ready"] {
  color: #fff;
  background: #087f75;
  border-color: #39b8ad;
}

.mobile-header-actions .mobile-install-toggle:disabled {
  cursor: default;
  color: #b8c2c8;
  background: #27343c;
  border-color: #4b5962;
}

.mobile-header-actions svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mobile-install-steps p {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  column-gap: 10px;
  align-items: center;
}

.mobile-install-steps p strong,
.mobile-install-steps p > span:last-child { grid-column: 2; }
.mobile-install-steps p > span:last-child { margin-top: 2px; }

.mobile-install-steps .install-step-icon {
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: #0b877f;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: -.02em;
}

.mobile-install-card .mobile-install-step,
.mobile-install-card .desktop-install-step { display: none; }
.mobile-install-card[data-install-mode="desktop"] .desktop-install-step,
.mobile-install-card[data-install-mode="mobile"] .mobile-install-step { display: grid; }
.mobile-install-card .qr-panel { display: none; }
.mobile-install-card[data-install-mode="mobile"] .qr-panel { display: grid; }

body.desktop-nav-collapsed .app-shell { grid-template-columns: minmax(0, 1fr); }
body.desktop-nav-collapsed .sidebar { display: none; }
.app-shell { height: calc(100vh - 156px); }

@media (min-width: 721px) and (max-width: 1360px) {
  .topbar {
    min-height: 212px;
    align-content: center;
    align-items: center;
    flex-wrap: wrap;
  }

  .header-button-grid {
    flex: 1 0 100%;
    grid-template-columns: repeat(3, minmax(0, 290px));
  }

  .mobile-header-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .app-shell { height: calc(100vh - 212px); }
}

@media (max-width: 980px) {
  .header-button-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .header-brand-button { padding-inline: 9px; }
  .app-shell { height: calc(100vh - 156px); }
}

@media (max-width: 720px) {
  .topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    min-height: 162px;
    padding: 52px 12px 10px;
  }

  .header-button-grid {
    display: flex;
    gap: 9px;
    overflow-x: auto;
    padding-bottom: 3px;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
  }

  .header-brand-button {
    flex: 0 0 210px;
    height: 98px;
    grid-template-rows: minmax(0, 1fr) 24px;
    padding: 6px 9px 5px;
    scroll-snap-align: start;
  }

  .header-juris-button { grid-template-rows: 1fr; }
  .header-thumb { height: 62px; }
  .header-thumb-juris { width: 68px; height: 68px; }
  .header-thumb-guide img { width: 46px; }
  .header-thumb-solia { padding: 9px 14px; }
  .header-button-copy strong { font-size: 9px; }
  .header-button-copy > span { font-size: 9px; }

  .mobile-header-actions {
    position: absolute;
    top: 8px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .mobile-header-actions .mobile-topics-button,
  .mobile-header-actions .mobile-print-button,
  .mobile-header-actions .mobile-install-toggle {
    min-width: 0;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    color: #fff;
    background: #22333d;
    border: 1px solid #71808a;
    border-radius: 6px;
    font-size: 9px;
    font-weight: 800;
  }

  .mobile-header-actions .mobile-install-toggle { min-width: 0; }
  .mobile-header-actions .mobile-version-toggle { display: none; }
  .mobile-install-card[data-install-mode="mobile"] .qr-panel { display: none !important; }
  .mobile-install-card[data-install-mode="desktop"] .mobile-install-step { display: none; }
  .mobile-install-card[data-install-mode="mobile"] .mobile-install-step { display: grid; }

  .mobile-header-actions svg {
    width: 14px;
    height: 14px;
  }

  .mobile-install-card:not([hidden]) {
    display: grid;
    grid-template-columns: 1fr;
    margin: 14px 0 18px;
  }

  .mobile-install-card .mobile-install-steps { grid-template-columns: 1fr; }
  .mobile-install-card .qr-panel { display: none; }
  .mobile-install-card[hidden] { display: none; }

  .app-shell { height: auto; }
}

@media print {
  .topbar { display: none !important; }
  .mobile-install-card { display: none !important; }
}
