.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
}

.sidebar {
  background: var(--sidebar);
  color: #fff;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 18px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #fff;
  color: #111827;
  font-weight: 900;
}

.brand-title {
  font-size: 15px;
  font-weight: 900;
}

.brand-sub {
  color: var(--sidebar-muted);
  font-size: 12px;
  margin-top: 2px;
}

.brand-copy {
  min-width: 0;
  flex: 1;
}

.theme-toggle {
  min-height: 36px;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .94);
  color: #314155;
  padding: 7px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(51, 72, 95, .08);
}

.theme-toggle:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.theme-icon {
  font-size: 14px;
  line-height: 1;
}

.theme-label {
  line-height: 1;
}

.nav {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  /* Smooth scroll on iOS Safari for the inner-scroll pattern. */
  -webkit-overflow-scrolling: touch;
  /* Pad the bottom so the last nav button isn't visually flush against the
     auth dock's top border once the dock is sticky. */
  padding-bottom: 4px;
}

.nav-auth-dock {
  flex: 0 0 auto;
  /* Stays at the bottom of the sidebar regardless of nav scroll position. */
  margin-top: auto;
  padding-top: 12px;
  /* Slight visual separation from the scrolling nav above. */
  border-top: 1px solid rgba(255, 255, 255, .08);
  background: var(--sidebar);
}

.nav button {
  width: 100%;
  border: 0;
  border-radius: 8px;
  color: #d1d5db;
  background: transparent;
  padding: 10px 11px;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.nav button:hover,
.nav button.active {
  background: rgba(255,255,255,.1);
  color: #fff;
}

.count {
  color: var(--sidebar-muted);
  font-size: 12px;
}

.main {
  padding: 22px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  letter-spacing: 0;
}

h2 {
  font-size: 17px;
  letter-spacing: 0;
}

#pageSubtitle,
#sectionHint,
#detailDesc {
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.5;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-widget {
  min-width: 0;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.auth-placeholder,
.auth-logout {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  padding: 7px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.auth-placeholder {
  color: var(--muted);
}

.auth-placeholder.needs-config {
  background: #fffaf0;
  color: #7c5420;
}

.auth-user {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  padding: 4px 5px 4px 6px;
  box-shadow: var(--shadow-soft);
}

.auth-avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 950;
  flex: 0 0 auto;
}

.auth-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.auth-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.auth-copy strong,
.auth-copy small {
  overflow: hidden;
  max-width: 150px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-copy strong {
  color: var(--text);
  font-size: 12px;
  line-height: 1.1;
}

.auth-copy small,
.auth-google-wrap small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
}

.auth-logout {
  min-height: 30px;
  border-color: transparent;
  background: var(--panel-2);
  cursor: pointer;
}

.auth-logout:hover {
  border-color: var(--line-strong);
}

.auth-google-wrap {
  display: grid;
  align-items: center;
  gap: 2px;
}

.google-signin-slot {
  min-height: 32px;
}

.auth-error {
  color: #b42318 !important;
}

.search {
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  padding: 0 10px;
  min-width: 300px;
}

.search span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.search input {
  border: 0;
  outline: 0;
  min-width: 0;
  flex: 1;
  background: transparent;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
}

.theme-btn {
  display: grid;
  place-items: center;
}
