/* Load after landing.css. The legacy .sidebar is now a top navigation header. */
body > main {
  width: 100%;
  max-width: none;
  margin: 0 !important;
  padding: 0;
}

body > .sidebar {
  --navigation-paper: #faf7ed;
  position: relative;
  inset: auto;
  width: 100%;
  max-width: none;
  height: auto;
  min-height: 82px;
  padding: 12px max(40px, calc((100vw - 1280px) / 2));
  flex-direction: row;
  align-items: center;
  gap: 26px;
  background: var(--navigation-paper);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 0 #23453d03;
  isolation: isolate;
  z-index: 10;
}
body > .sidebar:not([hidden]) { display: flex; }
body > .sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .075;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='paper'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' opacity='.4' filter='url(%23paper)'/%3E%3C/svg%3E");
}
body > .sidebar .sidebar-label,
body > .sidebar .sidebar-note { display: none; }
body > .sidebar .brand {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 2px 0;
  color: var(--ink);
  text-decoration: none;
}
body > .sidebar .brand-mark {
  font-size: 38px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -3px;
}
body > .sidebar .brand-mark .brand-dot {
  font-size: 24px;
  line-height: 1;
  font-weight: 800;
  color: var(--accent);
  margin-left: 5px;
}
body > .sidebar .brand-caption {
  max-width: 100px;
  font-size: 12px;
  line-height: 1.45;
  letter-spacing: 0;
  margin: 0;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}
body > .sidebar nav {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 5px;
  min-width: 0;
  margin: 0;
  padding: 5px 6px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 6px;
  scrollbar-width: thin;
  scrollbar-color: #b6cbb7 transparent;
}
body > .sidebar nav::-webkit-scrollbar { height: 4px; }
body > .sidebar nav::-webkit-scrollbar-track { background: transparent; }
body > .sidebar nav::-webkit-scrollbar-thumb { background: #b6cbb7; border-radius: 9px; }
body > .sidebar .nav-item:not([hidden]) {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: auto;
  min-height: 44px;
  margin: 0;
  padding: 10px 13px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
  white-space: nowrap;
  scroll-snap-align: start;
  box-shadow: none;
}
body > .sidebar .nav-item > span {
  display: inline-block;
  width: 16px;
  font-size: 14px;
  line-height: 1;
  color: currentColor;
  text-align: center;
  opacity: .6;
}
body > .sidebar .nav-item:hover { background: var(--wash); }
body > .sidebar .nav-item.active,
body > .sidebar .nav-item[aria-current="page"] {
  background: var(--mint);
  border-color: #23453d1a;
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 2px 0 #23453d10;
}
body > .sidebar .nav-item.active > span,
body > .sidebar .nav-item[aria-current="page"] > span { opacity: 1; color: var(--ink); }
body > .sidebar .nav-item:focus-visible,
body > .sidebar .brand:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
body > .sidebar .nav-item[hidden] { display: none !important; }

/* Each secondary page is centered without reserving any left rail. */
body:not([data-screen="home"]) > main > .view,
body:not([data-screen="home"]) > main > .topbar,
body:not([data-screen="home"]) > main > #global-status,
body:not([data-screen="home"]) > main > .page-footer {
  width: 100%;
  max-width: 1360px;
  margin-inline: auto;
  padding-inline: 40px;
}
body:not([data-screen="home"]) > main > .topbar {
  display: flex;
  height: auto;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
  padding-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
body:not([data-screen="home"]) > main > .topbar > span { min-width: 0; }
body:not([data-screen="home"]) > main > .topbar > div {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px 14px;
}
body:not([data-screen="home"]) .topbar .version { font-size: 12px; padding: 3px 9px; }
body:not([data-screen="home"]) .topbar #save-draft {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  font-size: 12px;
}
body:not([data-screen="home"]) .topbar #open-auth {
  min-height: 36px;
  padding: 7px 15px;
  font-size: 12px;
}
body:not([data-screen="home"]) .topbar #user-label {
  max-width: 200px;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body:not([data-screen="home"]) .topbar #logout { font-size: 12px; min-height: 36px; }

/* One navigation bar is shared by the homepage and workspace. */
body[data-screen="home"] > .app-navigation { --navigation-paper: #faf5e8; gap: 20px; }
body[data-screen="home"] > .app-navigation .brand-caption { display: none; }
.navigation-auth { display: none; }
body[data-screen="home"] .navigation-auth { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; min-height: 42px; padding: 9px 17px; border: 1px solid #24483a70; border-radius: 99px; background: transparent; color: var(--ink); font-size: 12px; white-space: nowrap; }
body[data-screen="home"] .navigation-auth:hover { background: #e5ecd6; }
body[data-screen="home"] > main > .topbar { display: none !important; }
body[data-screen="home"] > main { margin: 0 !important; padding: 0; width: 100%; max-width: none; }

@media (max-width: 1120px) {
  body > .sidebar { gap: 20px; padding-inline: 28px; }
  body > .sidebar .brand-caption { display: none; }
  body > .sidebar .nav-item:not([hidden]) { font-size: 14px; padding-inline: 12px; }
  body:not([data-screen="home"]) > main > .view,
  body:not([data-screen="home"]) > main > .topbar,
  body:not([data-screen="home"]) > main > #global-status,
  body:not([data-screen="home"]) > main > .page-footer { padding-inline: 28px; }
}
@media (max-width: 760px) {
  body > .sidebar {
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
    gap: 6px;
    padding: 12px 20px 6px;
  }
  body > .sidebar .brand { align-self: flex-start; gap: 12px; }
  body > .sidebar .brand-mark { font-size: 35px; }
  body > .sidebar .brand-caption { display: block; max-width: none; font-size: 12px; }
  body > .sidebar nav {
    flex: 0 1 auto;
    width: 100%;
    margin: 0;
    padding: 5px 6px;
    gap: 5px;
  }
  body > .sidebar .nav-item:not([hidden]) { min-height: 44px; padding: 10px 12px; border-radius: 10px; }
  body > .sidebar .nav-item > span { display: inline-block; font-size: 14px; }
  body:not([data-screen="home"]) > main > .view,
  body:not([data-screen="home"]) > main > .topbar,
  body:not([data-screen="home"]) > main > #global-status,
  body:not([data-screen="home"]) > main > .page-footer { padding-inline: 20px; }
  body:not([data-screen="home"]) > main > .topbar { flex-wrap: wrap; gap: 2px 12px; min-height: 52px; }
  body:not([data-screen="home"]) > main > .topbar > div { gap: 5px 12px; }
  body:not([data-screen="home"]) .topbar .version { display: none; }
  body:not([data-screen="home"]) .topbar #user-label { max-width: 140px; }
}
@media (max-width: 420px) {
  body > .sidebar { padding-inline: 16px; }
  body > .sidebar .brand-caption { font-size: 12px; max-width: 140px; }
  body:not([data-screen="home"]) > main > .view,
  body:not([data-screen="home"]) > main > .topbar,
  body:not([data-screen="home"]) > main > #global-status,
  body:not([data-screen="home"]) > main > .page-footer { padding-inline: 16px; }
  body:not([data-screen="home"]) > main > .topbar > span { flex-basis: 100%; }
  body:not([data-screen="home"]) > main > .topbar > div { justify-content: flex-start; }
  body:not([data-screen="home"]) .topbar #user-label { max-width: 110px; }
}
@media (pointer: coarse) {
  body:not([data-screen="home"]) .topbar #save-draft,
  body:not([data-screen="home"]) .topbar #open-auth,
  body:not([data-screen="home"]) .topbar #logout { min-height: 44px; }
}
@media print {
  body:not([data-screen="home"]) > .sidebar:not([hidden]),
  body > main > .topbar { display: none !important; }
  body > main { margin: 0 !important; padding: 0; }
  body:not([data-screen="home"]) > main > .view { max-width: none; padding-inline: 0; }
}

@media (max-width: 760px) {
  body[data-screen="home"] > .app-navigation:not([hidden]) { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; }
  body[data-screen="home"] > .app-navigation .brand { grid-column: 1; grid-row: 1; }
  body[data-screen="home"] > .app-navigation .navigation-auth { grid-column: 2; grid-row: 1; }
  body[data-screen="home"] > .app-navigation nav { grid-column: 1 / -1; grid-row: 2; }
}
@media print { body > .app-navigation:not([hidden]) { display: none !important; } }
