:root {
  --workspace-header-height: calc(4rem + env(safe-area-inset-top, 0px));
  --workspace-nav-height: 0px;
  --workspace-scroll-offset: calc(var(--workspace-header-height) + var(--workspace-nav-height));
}
:root:has(.workspace) {
  scroll-padding-block-start: var(--workspace-scroll-offset);
}
.workspace {
  grid-template-rows: var(--workspace-header-height) minmax(0, 1fr);
}
.workspace-header {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  height: var(--workspace-header-height);
  padding: env(safe-area-inset-top, 0px) clamp(0.85rem, 2.3vw, 2rem) 0;
  background: var(--strong);
  border-bottom: 1px solid var(--line);
}
.workspace-header .brand-link {
  padding: 0;
}
.header-tools {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.header-tools button {
  min-height: 44px;
}
.header-tools .settings-trigger {
  min-width: 44px;
  color: var(--accent);
}
.workspace .sidebar {
  position: sticky;
  top: var(--workspace-header-height);
  z-index: 3;
  align-self: start;
  height: calc(100dvh - var(--workspace-header-height));
  overflow-y: auto;
}
.main .inventory-group > summary {
  top: var(--workspace-scroll-offset);
}
.settings-fields {
  display: grid;
  gap: 1.2rem;
}
.settings-user {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.settings-user > span:nth-child(2) {
  min-width: 0;
}
.settings-user strong,
.settings-user small {
  display: block;
}
.settings-user button {
  margin-inline-start: auto;
}
.settings-section {
  border-top: 1px solid var(--line);
  padding-top: 1.1rem;
}
.settings-section > summary {
  color: var(--text);
  font-weight: 650;
  min-height: 44px;
  cursor: pointer;
}
.settings-section summary::-webkit-details-marker {
  display: inline;
}
.settings-form {
  display: grid;
  gap: 0.85rem;
}
.settings-form > button {
  justify-self: start;
}
.settings-help {
  margin: 0.4rem 0 0.85rem;
  color: var(--muted);
  font-size: 0.91rem;
}
.settings-logo-preview {
  display: grid;
  place-items: center;
  min-height: 80px;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #465668;
  font-size: 0.9rem;
}
.settings-logo-preview img {
  display: block;
  max-width: 100%;
  max-height: 80px;
}
.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.settings-form button:disabled {
  cursor: default;
}
.settings-form .form-error {
  margin: 0;
}
.settings-status {
  color: var(--muted);
  font-size: 0.9rem;
}
.settings-status:empty {
  display: none;
}
@media (max-width: 950px) {
  :root {
    --workspace-nav-height: 3.25rem;
  }
  .workspace .sidebar {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.3rem;
    height: var(--workspace-nav-height);
    overflow: visible;
    padding-top: 0.15rem;
    padding-bottom: 0.2rem;
  }
  .sidebar nav {
    flex: 1;
    min-width: 0;
  }
  .sidebar .side-foot {
    flex: none;
    margin: 0;
  }
  .sidebar #logout {
    min-width: 36px;
  }
  .workspace-header {
    padding-inline: max(0.85rem, calc((100vw - 730px) / 2));
  }
}
@media (max-width: 600px) {
  :root {
    --workspace-header-height: calc(3.5rem + env(safe-area-inset-top, 0px));
    --workspace-nav-height: 3.5rem;
  }
  .header-tools .theme {
    font-size: 0;
    gap: 0;
    padding: 0.45rem;
    min-width: 44px;
  }
}
@media (max-width: 360px) {
  .sidebar .nav-item {
    padding-inline: 0.24rem;
  }
}
@media (max-width: 600px), (max-width: 950px) and (max-height: 500px) and (orientation: landscape) and (pointer: coarse) {
  :root {
    --phone-safe-top: env(safe-area-inset-top, 0px);
    --workspace-scroll-offset: calc(var(--workspace-nav-height) + var(--phone-safe-top));
  }
  .workspace-header {
    position: relative;
  }
  .workspace .sidebar {
    top: 0;
    height: var(--workspace-scroll-offset);
    /* Reserve the safe area once, even while the logo header is visible. */
    margin-block-start: calc(0px - var(--phone-safe-top));
    padding-block-start: calc(0.15rem + var(--phone-safe-top));
  }
}
