export function readCookie(name: string): string | null {
  if (typeof document === 'undefined') return null
  const target = `${name}=`
  const match = document.cookie
    .split('; ')
    .find((row) => row.startsWith(target))
  if (!match) return null
  return decodeURIComponent(match.slice(target.length))
}
